%PDF- %PDF-
| Direktori : /lib/python3/dist-packages/samba/netcmd/__pycache__/ |
| Current File : //lib/python3/dist-packages/samba/netcmd/__pycache__/contact.cpython-312.pyc |
�
�I�d�y � �X � d dl mZ d dlZd dlZd dlZd dlmZmZ d dl m
Z
d dlmZ d dl
mZ d dlmZmZ d dlmZ d dlmZmZmZmZ d d lmZ d
dlmZ G d� d
e� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z! G d� de� Z" G d� de� Z# G d� de� Z$y)� N)�
check_call�CalledProcessError)�
attrgetter)�system_session)�SamDB)�credentials�dsdb)�Net)�Command�CommandError�SuperCommand�Option)� get_bytes� )�commonc �� � e Zd ZdZdZ edddedd�� ed d
e�� edd
e�� edde�� edde�� edde�� edde�� edde�� edde�� edde�� edde�� edde�� ed d!e�� ed"d#e�� ed$d%e�� gZd&gZe j e j e j d'�Z
d*d)�Zy()+�cmd_adda� Add a new contact.
This command adds a new contact to the Active Directory domain.
The name of the new contact can be specified by the first argument
'contactname' or the --given-name, --initial and --surname arguments.
If no 'contactname' is given, contact's name will be made up of the given
arguments by combining the given-name, initials and surname. Each argument
is optional. A dot ('.') will be appended to the initials automatically.
Example1:
samba-tool contact add "James T. Kirk" --job-title=Captain \
-H ldap://samba.samdom.example.com -UAdministrator%Passw1rd
The example shows how to add a new contact to the domain against a remote
LDAP server.
Example2:
samba-tool contact add --given-name=James --initials=T --surname=Kirk
The example shows how to add a new contact to the domain against a local
server. The resulting name is "James T. Kirk".
z%prog [contactname] [options]�-H�--URL�%LDB URL for database or target server�URL�H��help�type�metavar�destz--ouz�DN of alternative location (with or without domainDN counterpart) in which the new contact will be created. E.g. 'OU=<OU name>'. Default is the domain base.�r r � --surnamezContact's surname�--given-namezContact's given name�
--initialszContact's initials�--display-namezContact's display namez--job-titlezContact's job titlez--departmentzContact's departmentz --companyzContact's companyz
--descriptionzContact's description�--mail-addresszContact's email addressz--internet-addresszContact's home pagez--telephone-numberzContact's phone numberz--mobile-numberzContact's mobile phone numberz--physical-delivery-officezContact's office locationzfullcontactname?�� sambaopts�credopts�versionoptsNc �, � |j � }|j |� } t |t � ||�� }|j ||||| |
|||
||||||�� }| j j d|z � y # t
$ r}t
d|� �d }~ww xY w)N��url�session_infor �lp)�fullcontactname�ou�surname� givenname�initials�displayname�jobtitle�
department�company�description�mailaddress�internetaddress�telephonenumber�mobilenumber�physicaldeliveryofficezFailed to add contactz Contact '%s' added successfully
) �get_loadparm�get_credentialsr r �
newcontact� Exceptionr �outf�write)�selfr- r% r&