Infinity.AclSheetSet¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
n_sheets |
r/w |
The number of elements in the sheets array. |
|
own_sheets |
r |
||
sheets |
r/w |
An array of |
Methods¶
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Infinity.AclSheetSet¶
A set of
Infinity.AclSheet
s, one for each user.- classmethod from_xml(xml)¶
- Parameters:
xml (
libxml2.NodePtr
) – The XML node from which to read the sheet set.- Raises:
- Returns:
A
Infinity.AclSheetSet
, orNone
. Free withInfinity.AclSheetSet.free
() when no longer needed.- Return type:
Reads a sheet set from xml that has been written with
Infinity.AclSheetSet.to_xml
(). If an error occurs the function returnsNone
and error is set. If there is no ACL stored in xml, the function returnsNone
without setting error.
- classmethod new()¶
- Returns:
A new
Infinity.AclSheetSet
. Free withInfinity.AclSheetSet.free
().- Return type:
Creates a new
Infinity.AclSheetSet
. Add sheets withInfinity.AclSheetSet.add_sheet
().
- classmethod new_external(sheets)¶
- Parameters:
sheets ([
Infinity.AclSheet
]) – An array ofInfinity.AclSheet
s- Returns:
A new
Infinity.AclSheetSet
. Free withInfinity.AclSheetSet.free
() when no longer needed.- Return type:
Creates a new
Infinity.AclSheetSet
refererencing the given ACL sheets. The created sheet set is only holding a reference to the given array, so it must stay alive as long as the sheet set is alive.No new sheets can be added to the returned sheet set with
Infinity.AclSheetSet.add_sheet
(), or removed withInfinity.AclSheetSet.remove_sheet
().
- add_sheet(account)¶
- Parameters:
account (
int
) – The #InfAclAccountId representing a unique account ID.- Returns:
A
Infinity.AclSheet
for the new account.- Return type:
Adds a new default sheet for account to self. The function returns a pointer to the new sheet. The pointer stays valid as long as no other sheet is added to the set. If there is already a sheet for account in the set, then the existing sheet is returned instead.
This function can only be used if the sheet set has not been created with the
Infinity.AclSheetSet.new_external
() function.
- copy()¶
- Returns:
A new
Infinity.AclSheetSet
. Free withInfinity.AclSheetSet.free
() when no longer needed.- Return type:
Creates a copy of self. If self was created with
Infinity.AclSheetSet.new_external
(), the copied sheet set will also only hold a reference to the external sheets, and the same restrictions apply.
- find_const_sheet(account)¶
- Parameters:
account (
int
) – The #InfAclAccountId representing the unique account ID of the account whose ACL sheet is to be found.- Returns:
A
Infinity.AclSheet
for account, orNone
.- Return type:
Returns the
Infinity.AclSheet
for account. If there is no such sheet in self, the function returnsNone
.The difference between this function and
Infinity.AclSheetSet.find_sheet
() is that this function returns a sheet that cannot be modified, but it can also be used on a sheet set created with theInfinity.AclSheetSet.new_external
() function.
- find_sheet(account)¶
- Parameters:
account (
int
) – The #InfAclAccountId representing the unique account ID of the account whose ACL sheet is to be found.- Returns:
A
Infinity.AclSheet
for account, orNone
.- Return type:
Returns the
Infinity.AclSheet
for account. If there is no such sheet in self, the function returnsNone
.This function can only be used if the sheet set has not been created with the
Infinity.AclSheetSet.new_external
() function.
- free()¶
Releases all resources allocated for self.
- get_clear_sheets()¶
- Returns:
A new
Infinity.AclSheetSet
. Free withInfinity.AclSheetSet.free
() when no longer needed.- Return type:
Returns a new sheet set with all sheets that are present in self, but with all permissions masked. When this set is merged with the original set, all permissions will be reset to default for all accounts. Before the merge, the returned sheet set can be modified. This allows to replace the current permissions with new ones atomically.
- merge_sheets(other)¶
- Parameters:
other (
Infinity.AclSheetSet
) – The sheet set to merge.- Returns:
The merged sheet set, or
None
when the merged sheet set would be empty.- Return type:
Replaces all sheets that are present in other in self with the ones from other. Note that an empty sheet in other (with all permissions masked out) causes the corresponding sheet in self to be removed.
If self is
None
it is treated like an empty sheet set, i.e. the merged sheet set is a copy of other. In that case a new sheet set is created and returned, unless other is empty. If the merged sheet set ends up empty, it is freed and the function returnsNone
.
- remove_sheet(sheet)¶
- Parameters:
sheet (
Infinity.AclSheet
) – The sheet to remove.
Removes a sheet from self. sheet must be one of the sheets inside self. The sheet is removed by replacing it with the last sheet in the set, so the order of sheets is not preserved.
This function can only be used if the sheet set has not been created with the
Infinity.AclSheetSet.new_external
() function.
- sink()¶
If a sheet set was created with
Infinity.AclSheetSet.new_external
(), this function lifts the restrictions that come with it by making an internal copy of the ACL sheets.
- to_xml(xml)¶
- Parameters:
xml (
libxml2.NodePtr
) – The XML node to serialize self into.
Serializes the sheet set given by self into an XML node. The sheet set can be deserialized again with
Infinity.AclSheetSet.from_xml
().