File: //lib/python3/dist-packages/samba/netcmd/__pycache__/contact.cpython-310.pyc
o
�/a�y � @ s( 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 dd
� d
e�ZG dd� de�ZG dd� de�ZG dd� de�Z G dd� de�Z!G dd� de�Z"G dd� de�Z#G dd� de�Z$dS )� N)�
check_call�CalledProcessError)�
attrgetter)�system_session)�SamDB)�credentials�dsdb)�Net)�Command�CommandError�SuperCommand�Option)� get_bytes� )�commonc @ s e Zd ZdZdZedddeddd�ed d
ed�edd
ed�edded�edded�edded�edded�edded�edded�edded�edded�edded�ed d!ed�ed"d#ed�ed$d%ed�gZd&gZe j
e je jd'�Z
( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (d+d)d*�Zd(S ),�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 C s� |� � }|�|�}zt|t� ||d�}|j||||| |
|||
||||||d�}W n ty9 } ztd|��d }~ww | j�d| � d S )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$ r% r r+ r, �
given_namer. �display_name� job_titler1 r2 r3 �mail_address�internet_address�telephone_number�
mobile_number�physical_delivery_officer) �creds�samdb�ret_name�e� rL �6/usr/lib/python3/dist-packages/samba/netcmd/contact.py�runj s<