a *Na8@sddlmZddlmZddlmZddlmZmZmZddl m Z m Z m Z m Z mZmZmZmZmZmZddlmZddlmZgd ZGd d d eeZGd d d ee e eZGdddeeZGdddee e eZGdddeeZGdddee e eZGdddeeZGddde eeZ GdddeZ!Gddde eZ"GdddeeeZ#Gd d!d!e eZ$Gd"d#d#eZ%Gd$d%d%eeZ&Gd&d'd'eeZ'Gd(d)d)ee e eZ(Gd*d+d+eZ)Gd,d-d-eZ*Gd.d/d/e eZ+Gd0d1d1eeZ,Gd2d3d3eeZ-Gd4d5d5ee e eZ.Gd6d7d7eeZ/Gd8d9d9ee e eZ0Gd:d;d;e eZ1Gdd?d?eeZ3Gd@dAdAeZ4GdBdCdCeeZ5GdDdEdEeZ6GdFdGdGee eZ7GdHdIdIeeZ8GdJdKdKeeZ9dLS)M)cli) exceptions)types)RequiredOptional RESTManager RESTObject) CreateMixin CRUDMixin DeleteMixinGetWithoutIdMixin ListMixin NoUpdateMixinObjectDeleteMixin RetrieveMixin SaveMixin UpdateMixin)UserCustomAttributeManager)UserEventManager)CurrentUserEmailCurrentUserEmailManagerCurrentUserGPGKeyCurrentUserGPGKeyManagerCurrentUserKeyCurrentUserKeyManagerCurrentUserStatusCurrentUserStatusManager CurrentUserCurrentUserManagerUser UserManager ProjectUserProjectUserManager UserEmailUserEmailManagerUserActivities UserStatusUserStatusManagerUserActivitiesManager UserGPGKeyUserGPGKeyManagerUserKeyUserKeyManagerUserIdentityProviderManagerUserImpersonationTokenUserImpersonationTokenManagerUserMembershipUserMembershipManager UserProjectUserProjectManagerc@seZdZdZdS)remailN__name__ __module__ __qualname___short_print_attrr:r:r/private/var/folders/js/6pj4vh5d4zd0k6bxv74qrbhr0000gr/T/pip-target-22xwyzbs/lib/python/gitlab/v4/objects/users.pyr8src@seZdZdZeZeddZdS)rz /user/emailsr4requiredN)r6r7r8_pathr_obj_clsr _create_attrsr:r:r:r;r<src@s eZdZdS)rNr6r7r8r:r:r:r;rBsrc@seZdZdZeZeddZdS)rz/user/gpg_keyskeyr=N)r6r7r8r?rr@rrAr:r:r:r;rFsrc@seZdZdZdS)rtitleNr5r:r:r:r;rLsrc@seZdZdZeZeddZdS)rz /user/keysrErDr=N)r6r7r8r?rr@rrAr:r:r:r;rPsrc@seZdZdZdZdS)rNmessager6r7r8_id_attrr9r:r:r:r;rVsrc@seZdZdZeZeddZdS)rz /user/status)emojirGoptionalN)r6r7r8r?rr@r _update_attrsr:r:r:r;r[src@seZdZdZdZdZdS)rNusername))statusr)emailsr)gpgkeysr)keysr)r6r7r8rIr9 _managersr:r:r:r;rasrc@seZdZdZeZdS)rz/userN)r6r7r8r?rr@r:r:r:r;rlsrc@seZdZdZdZedeej ddZ edeej ddZ edeej ddZedeejd d Zedeejd d Zedeejd dZdS)rrN) )Zcustomattributesr)rPr$)Zfollowers_usersUserFollowersManager)Zfollowing_usersUserFollowingManager)eventsr)rQr*)Zidentityprovidersr-)Zimpersonationtokensr/)rRr,)Z membershipsr1)Zprojectsr3)rOr'cKs6d|j}|jjj|fi|}|dur2d|jd<|S)aRBlock the user. Args: **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabAuthenticationError: If authentication is not correct GitlabBlockError: If the user could not be blocked Returns: bool: Whether the user status has been changed z/users/%s/blockTblockedstateidmanagergitlab http_post_attrsselfkwargspathZ server_datar:r:r;blocks   z User.blockcKs d|j}|jjj|fi|S)aUFollow the user. Args: **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabAuthenticationError: If authentication is not correct GitlabFollowError: If the user could not be followed Returns: dict: The new object data (*not* a RESTObject) z/users/%s/followrZr[r\r]r`rarbr:r:r;follows z User.followcKs d|j}|jjj|fi|S)aYUnfollow the user. Args: **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabAuthenticationError: If authentication is not correct GitlabUnfollowError: If the user could not be followed Returns: dict: The new object data (*not* a RESTObject) z/users/%s/unfollowrdrer:r:r;unfollows z User.unfollowcKs6d|j}|jjj|fi|}|dur2d|jd<|S)aXUnblock the user. Args: **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabAuthenticationError: If authentication is not correct GitlabUnblockError: If the user could not be unblocked Returns: bool: Whether the user status has been changed z/users/%s/unblockTactiverXrYr_r:r:r;unblocks   z User.unblockcKs2d|j}|jjj|fi|}|r.d|jd<|S)a`Deactivate the user. Args: **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabAuthenticationError: If authentication is not correct GitlabDeactivateError: If the user could not be deactivated Returns: bool: Whether the user status has been changed z/users/%s/deactivateZ deactivatedrXrYr_r:r:r; deactivates   zUser.deactivatecKs2d|j}|jjj|fi|}|r.d|jd<|S)aZActivate the user. Args: **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabAuthenticationError: If authentication is not correct GitlabActivateError: If the user could not be activated Returns: bool: Whether the user status has been changed z/users/%s/activaterhrXrYr_r:r:r;activates   z User.activateN)r6r7r8r9rSrZregister_custom_actionexcZ on_http_errorZGitlabBlockErrorrcZGitlabFollowErrorrfZGitlabUnfollowErrorrgZGitlabUnblockErrorriZGitlabDeactivateErrorrjZGitlabActivateErrorrkr:r:r:r;rqs(           rc@s<eZdZdZeZdZeddZedddZ e j e j dZ d S) r z/users) rhrWrN extern_uidproviderexternalsearchcustom_attributesrOZ two_factor)r4rNnamepasswordZreset_passwordskypelinkedintwitterprojects_limitrmrnbioadmincan_create_group website_urlZskip_confirmationro organizationlocationavatar public_emailprivate_profilecolor_scheme_idtheme_idrK)r4rNrr)rsrtrurvrwrmrnrxryrzr{Zskip_reconfirmationror|r}r~rrrrr>rL)Zconfirmr~N)r6r7r8r?rr@ _list_filtersrrArMrZLowercaseStringAttributeZImageAttribute_typesr:r:r:r;r s r c@s eZdZdS)r!NrBr:r:r:r;r!Csr!c@s*eZdZdZeZddiZdZdej iZ dS)r"z/projects/%(project_id)s/usersZ project_idrZ)rp skip_usersrN) r6r7r8r?r!r@_from_parent_attrsrrZ ListAttributerr:r:r:r;r"Gs r"c@seZdZdZdS)r#r4Nr5r:r:r:r;r#Osr#c@s&eZdZdZeZddiZeddZdS)r$z/users/%(user_id)s/emailsuser_idrZr<r=N) r6r7r8r?r#r@rrrAr:r:r:r;r$Ssr$c@seZdZdZdS)r%rNNr6r7r8rIr:r:r:r;r%Zsr%c@seZdZdZdZdS)r&NrGrHr:r:r:r;r&^sr&c@seZdZdZeZddiZdS)r'z/users/%(user_id)s/statusrrZN)r6r7r8r?r&r@rr:r:r:r;r'csr'c@seZdZdZeZdS)r(z/user/activitiesN)r6r7r8r?r%r@r:r:r:r;r(isr(c@s eZdZdS)r)NrBr:r:r:r;r)nsr)c@s&eZdZdZeZddiZeddZdS)r*z/users/%(user_id)s/gpg_keysrrZrCr=N) r6r7r8r?r)r@rrrAr:r:r:r;r*rsr*c@s eZdZdS)r+NrBr:r:r:r;r+ysr+c@s&eZdZdZeZddiZeddZdS)r,z/users/%(user_id)s/keysrrZrFr=N) r6r7r8r?r+r@rrrAr:r:r:r;r,}sr,c@seZdZdZdZddiZdS)r-zManager for user identities. This manager does not actually manage objects but enables functionality for deletion of user identities by provider. z/users/%(user_id)s/identitiesrrZN)r6r7r8__doc__r?rr:r:r:r;r-sr-c@s eZdZdS)r.NrBr:r:r:r;r.sr.c@s,eZdZdZeZddiZedddZdZ dS) r/z'/users/%(user_id)s/impersonation_tokensrrZ)rrZscopes)Z expires_atr)rXN) r6r7r8r?r.r@rrrArr:r:r:r;r/sr/c@seZdZdZdS)r0Z source_idNrr:r:r:r;r0sr0c@s eZdZdZeZddiZdZdS)r1z/users/%(user_id)s/membershipsrrZ)typeN)r6r7r8r?r0r@rrr:r:r:r;r1sr1c@s eZdZdS)r2NrBr:r:r:r;r2sr2c@s4eZdZdZeZddiZedddZdZ dd Z d S) r3z/projects/user/%(user_id)srrZ)rr) Zdefault_branchZissues_enabledZ wall_enabledZmerge_requests_enabledZ wiki_enabledZsnippets_enabledpublic visibility descriptionZbuilds_enabledZ public_buildsZ import_urlZ"only_allow_merge_if_build_succeedsr)ZarchivedrZorder_bysortrpsimpleZownedZ membershipZstarred statisticsZwith_issues_enabledZwith_merge_requests_enabledZwith_custom_attributesZwith_programming_languageZwiki_checksum_failedZrepository_checksum_failedZmin_access_levelZid_afterZ id_beforecKs6|jrd|jj}n d|d}tj|fd|i|S)aRetrieve a list of objects. Args: all (bool): If True, return all the items, without pagination per_page (int): Number of items to retrieve per request page (int): ID of the page to return (starts with page 1) as_list (bool): If set to False and no pagination option is defined, return a generator instead of a list **kwargs: Extra options to send to the server (e.g. sudo) Returns: list: The list of objects, or a generator if `as_list` is False Raises: GitlabAuthenticationError: If authentication is not correct GitlabListError: If the server cannot perform the request z/users/%s/projectsrrb)_parentrZr listrer:r:r;rs zUserProjectManager.listN) r6r7r8r?r2r@rrrArrr:r:r:r;r3sr3c@seZdZdZeZddiZdS)rTz/users/%(user_id)s/followersrrZNr6r7r8r?rr@rr:r:r:r;rTsrTc@seZdZdZeZddiZdS)rUz/users/%(user_id)s/followingrrZNrr:r:r:r;rUsrUN):r\rrrlrZ gitlab.baserrrZ gitlab.mixinsrr r r r r rrrrrqrrVr__all__rrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3rTrUr:r:r:r;sR   0  #  H  E