4.3.2.3. PermissionsGroup¶
-
class
dyn.tm.accounts.
PermissionsGroup
(group_name, *args, **kwargs)[source]¶ A DynECT System Permissions Group object
-
__init__
(group_name, *args, **kwargs)[source]¶ Create a new permissions Group
Parameters: - group_name – The name of the permission group to update
- description – A description of the permission group
- group_type – The type of the permission group. Valid values: plain or default
- all_users – If ‘Y’, all current users will be added to the group. Cannot be used if user_name is passed in
- permission – A list of permissions that the group contains
- user_name – A list of users that belong to the permission group
- subgroup – A list of groups that belong to the permission group
- zone – A list of zones where the group’s permissions apply
-
add_permission
(permission)[source]¶ Adds individual permissions to the user
Parameters: permission – the permission to add to this user
-
add_subgroup
(name)[source]¶ Add a new Sub group to this
PermissionsGroup
Parameters: name – The name of the PermissionsGroup
to be added to thisPermissionsGroup
‘s subgroups
-
add_zone
(zone, recurse='Y')[source]¶ Add a new Zone to this
PermissionsGroup
Parameters: - zone – The name of the Zone to be added to this
PermissionsGroup
- recurse – A flag determining whether or not to add all sub-nodes
of a Zone to this
PermissionsGroup
- zone – The name of the Zone to be added to this
-
all_users
¶ If ‘Y’, all current users will be added to the group. Cannot be used if user_name is passed in
-
delete_subgroup
(name)[source]¶ Remove a Subgroup from this
PermissionsGroup
Parameters: name – The name of the PermissionsGroup
to be remoevd from thisPermissionsGroup
‘s subgroups
-
description
¶ A description of this permission group
-
group_name
¶ The name of this permission group
-
group_type
¶ The type of this permission group
-
permission
¶ A list of permissions that this group contains
-
remove_permission
(permission)[source]¶ Removes the specific permission from the user
Parameters: permission – the permission to remove
-
replace_permissions
(permission=None)[source]¶ Replaces a list of individual user permissions for the user
Parameters: permission – A list of permissions. Pass an empty list or omit the argument to clear the list of permissions of the user
-
subgroup
¶ A list of groups that belong to the permission group
-
update_subgroup
(subgroups)[source]¶ Update the subgroups under this
PermissionsGroup
Parameters: subgroups – The subgroups with updated information
-
user_name
¶ A list of users that belong to the permission group
-
zone
¶ A list of users that belong to the permission group
-
4.3.2.3.1. PermissionsGroup Examples¶
The following examples highlight how to use the PermissionsGroup
class
to get/create PermissionsGroup
‘s on the dyn.tm System and how to edit
these objects from within a Python script.
4.3.2.3.1.1. Creating a new PermissionsGroup¶
The following example shows how to create a new PermissionsGroup
on the
dyn.tm System and how to edit some of the fields using the returned
PermissionsGroup
object.
>>> from dyn.tm.accounts import PermissionsGroup
>>> # Create a dyn.tmSession
>>> new_group = PermissionsGroup('newgroupname', 'description_of_new_group')
>>> new_group.type
u'default'
>>> new_group.add_permission('ZoneUpdate')
>>> new_group.permission
['ZoneUpdate']
>>> # Note that assigning new_group.permission will clear all permissions
>>> new_group.permission = ['ZoneGet']
>>> new_group.permission
['ZoneGet']
>>> # Also note this is functionally equivalent to calling replace_permission
>>> new_group.replace_permission(['ZoneCreate'])
>>> new_group.permission
['ZoneCreate']
4.3.2.3.1.2. Getting an Existing PermissionsGroup¶
The following example shows how to get an existing User
from the
dyn.tm System and how to edit some of the same fields mentioned above.
>>> from dyn.tm.accounts import PermissionsGroup
>>> # Create a dyn.tmSession
>>> my_group = PermissionsGroup('newgroupname')
>>> my_group.type
u'default'
>>> my_group.type = 'plain'
>>> my_group.type
u'plain'
>>> my_group.description = 'A better group description.'
>>> my_group.description
u'A better group description.'