Infinity.AclSheetSet

Fields

Name

Type

Access

Description

n_sheets

int

r/w

The number of elements in the sheets array.

own_sheets

Infinity.AclSheet

r

sheets

Infinity.AclSheet

r/w

An array of Infinity.AclSheet objects.

Methods

class

from_xml (xml)

class

new ()

class

new_external (sheets)

add_sheet (account)

copy ()

find_const_sheet (account)

find_sheet (account)

free ()

get_clear_sheets ()

merge_sheets (other)

remove_sheet (sheet)

sink ()

to_xml (xml)

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:

GLib.Error

Returns:

A Infinity.AclSheetSet, or None. Free with Infinity.AclSheetSet.free() when no longer needed.

Return type:

Infinity.AclSheetSet

Reads a sheet set from xml that has been written with Infinity.AclSheetSet.to_xml(). If an error occurs the function returns None and error is set. If there is no ACL stored in xml, the function returns None without setting error.

classmethod new()
Returns:

A new Infinity.AclSheetSet. Free with Infinity.AclSheetSet.free().

Return type:

Infinity.AclSheetSet

Creates a new Infinity.AclSheetSet. Add sheets with Infinity.AclSheetSet.add_sheet().

classmethod new_external(sheets)
Parameters:

sheets ([Infinity.AclSheet]) – An array of Infinity.AclSheet s

Returns:

A new Infinity.AclSheetSet. Free with Infinity.AclSheetSet.free() when no longer needed.

Return type:

Infinity.AclSheetSet

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 with Infinity.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:

Infinity.AclSheet

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 with Infinity.AclSheetSet.free() when no longer needed.

Return type:

Infinity.AclSheetSet

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, or None.

Return type:

Infinity.AclSheet

Returns the Infinity.AclSheet for account. If there is no such sheet in self, the function returns None.

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 the Infinity.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, or None.

Return type:

Infinity.AclSheet

Returns the Infinity.AclSheet for account. If there is no such sheet in self, the function returns None.

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 with Infinity.AclSheetSet.free() when no longer needed.

Return type:

Infinity.AclSheetSet

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:

Infinity.AclSheetSet or None

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 returns None.

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().