Package perforce :: Module objects :: Class User
[frames] | no frames]

Class User



object --+    
         |    
FormObject --+
             |
            User

A Perforce user object.

Instance Methods
 
__init__(self, connection, userName)
Initialises the User based on the form retrieved on the connection.
 
save(self, force=False)
Save any changes made to the user to the Perforce server.
 
delete(self, force=False)
Delete this user from the Perforce server.
 
setPassword(self, newPassword, oldPassword=None)
Set a new password for this user.

Inherited from FormObject: __delitem__, __getitem__, __iter__, __setitem__

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, connection, userName)
(Constructor)

 
Initialises the User based on the form retrieved on the connection.
Parameters:
  • connection (perforce.connection.Connection) - The connection to the Perforce server to use.
  • userName (str or unicode) - The name of the user to query.
Raises:
  • CommandError - If there was a Perforce error querying the user.
Overrides: FormObject.__init__

save(self, force=False)

 

Save any changes made to the user to the Perforce server.

By default a user can only update their own user specification. Specifying the force parameter as True allows users with 'super' access to modify other user's specifications and to modify the 'Update' field.
Parameters:
  • force (boolean) - Flag indicating whether the update is forced.
Raises:
  • CommandError - If the operation failed due to Perforce errors.

delete(self, force=False)

 

Delete this user from the Perforce server.

By default a user can only delete their own user specification. Specifying the force parameter as True allows users with 'super' access to delete other users.
Parameters:
  • force (boolean) - Flag indicating whether to force deletion of the user.
Raises:
  • CommandError - If the operation failed due to Perforce errors.

setPassword(self, newPassword, oldPassword=None)

 

Set a new password for this user.

By default a user can only change their own password, and then only if they correctly provide their old password. However, users with 'super' access can set new passwords for other users without providing the old password.
Parameters:
  • newPassword (str, unicode or None) - The new password to set. Pass None or '' for the new password to set it to blank.
  • oldPassword (str, unicode or None) - The old password. Leave as None to set someone else's password without the old password (provided you have 'super' access).
Raises:
  • CommandError - If the operation failed due to Perforce errors.