user_groups

package
v0.0.0-...-aeb4a1d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package user_groups handles user management functions related to groups.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMyDirectAdminGroupIDs

func GetMyDirectAdminGroupIDs(stub cached_stub.CachedStubInterface, userID string) ([]string, error)

GetMyDirectAdminGroupIDs returns a list of group IDs for which the user is a direct admin.

func GetMyDirectGroupIDs

func GetMyDirectGroupIDs(stub cached_stub.CachedStubInterface, userID string) ([]string, error)

GetMyDirectGroupIDs returns a list of group IDs for which the user is a direct member.

func GiveAdminPermissionOfGroup

func GiveAdminPermissionOfGroup(stub cached_stub.CachedStubInterface, caller data_model.User, userID string, groupID string) error

GiveAdminPermissionOfGroup gives user admin permission to a group. Caller must be an admin of the group.

func GiveAuditorPermissionOfGroup

func GiveAuditorPermissionOfGroup(stub cached_stub.CachedStubInterface, caller, auditor, group data_model.User) error

GiveAuditorPermissionOfGroup adds group audit permission to a user for the given auditor and group objects. Caller must be admin of group.

func GiveAuditorPermissionOfGroupById

func GiveAuditorPermissionOfGroupById(stub cached_stub.CachedStubInterface, caller data_model.User, auditorID string, groupID string, keyPaths ...[]string) error

GiveAuditorPermissionOfGroupById adds group audit permission to a user for the given auditorID and groupID. Caller must be direct or indirect admin of group. keyPaths are optional parameters. If passed in, they are used to get group's keys. The first keyPath is for getting group symKey, the second keyPath is for getting group privateKey.

func IsParentGroup

func IsParentGroup(stub cached_stub.CachedStubInterface, caller data_model.User, parentGroupID string, childGroupID string) bool

IsParentGroup returns true if parentGroup is a direct or indirect parent of childGroup, false otherwise.

func IsUserAdminOfGroup

func IsUserAdminOfGroup(stub cached_stub.CachedStubInterface, userID string, groupID string) (bool, []string, error)

IsUserAdminOfGroup checks if a user is a direct or indirect admin of a group. If it is an admin, returns a user admin chain as well. If not, returns an empty list.

func IsUserDirectAdminOfGroup

func IsUserDirectAdminOfGroup(stub cached_stub.CachedStubInterface, userID string, groupID string) (bool, error)

IsUserDirectAdminOfGroup is a helper function that checks if user is a direct admin of a group.

func IsUserInGroup

func IsUserInGroup(stub cached_stub.CachedStubInterface, userID string, groupID string) (bool, error)

IsUserInGroup returns true if a user is either a direct or indirect member of a group.

func IsUserMemberOfGroup

func IsUserMemberOfGroup(stub cached_stub.CachedStubInterface, userID string, groupID string) (bool, error)

IsUserMemberOfGroup returns true if a user is in a group. This function does not check indirect membership.

func PutUserInGroup

func PutUserInGroup(stub cached_stub.CachedStubInterface, caller data_model.User, userID string, groupID string, isAdmin bool, keyPaths ...[]string) error

PutUserInGroup adds the user as a member of the group. If the user is already a member of the group, then the admin status can be updated. Admins have read/write access to any assets that the group has read/write access to. Members have read access to assets that the group has read access to. userID must be the ID of a user, not a group. groupID must be the ID of a group, not a user. If isAdmin is true, user will be given write access to group assets. Caller must be an admin of the group in order to add members and admins. keyPaths are optional parameters. If passed in, they are used to get group's keys. The first keyPath is for getting the group symKey, and the second keyPath is for getting the group privateKey.

func RegisterSubgroup

func RegisterSubgroup(stub cached_stub.CachedStubInterface, caller data_model.User, args []string) ([]byte, error)

RegisterSubgroup registers a new group as a subgroup of an existing group. Admins of the parent group are admins of the subgroup. Members of the subgroup are members of parent group. Auditors of the parent group are auditors of the subgroup. Subgroups can only have one parent group.

args = [subgroup, parentGroupID]

subgroup is the subgroup to be registered. parentGroupID is the id of the parent group.

func RegisterSubgroupWithParams

func RegisterSubgroupWithParams(stub cached_stub.CachedStubInterface, caller data_model.User, subgroup data_model.User, parentGroupID string, keyPaths ...[]string) error

RegisterSubgroupWithParams registers a new group as a subgroup of an existing group. "WithParams" functions should only be called from within the chaincode.

subgroup is the subgroup to register. parentGroupID is the id of the parent group. keyPaths are optional parameters. If passed in, they are used to get the parent group's keys. The first keyPath is for getting the parent group symKey, and the second keyPath is for getting the parent group privateKey.

func RemoveAdminPermissionOfGroup

func RemoveAdminPermissionOfGroup(stub cached_stub.CachedStubInterface, caller data_model.User, args []string) ([]byte, error)

RemoveAdminPermissionOfGroup removes group admin permission from a user. Caller must be an admin of the group.

args = [userID, groupID]

func RemoveAdminPermissionOfGroupWithParams

func RemoveAdminPermissionOfGroupWithParams(stub cached_stub.CachedStubInterface, caller data_model.User, userID string, groupID string, keyPaths ...[]string) error

RemoveAdminPermissionOfGroupWithParams is the internal function for removing group admin permission from a user. "WithParams" functions should only be called from within the chaincode.

keyPaths are optional parameters. If passed in, they are used to get group's keys. The first keyPath is for getting the group symKey, and the second keyPath is for getting the group privateKey.

func RemoveAuditorPermissionOfGroup

func RemoveAuditorPermissionOfGroup(stub cached_stub.CachedStubInterface, caller data_model.User, auditorID string, groupID string) error

RemoveAuditorPermissionOfGroup removes group auditor's permission from a user. Caller must be admin of group.

func RemoveSubgroupFromGroup

func RemoveSubgroupFromGroup(stub cached_stub.CachedStubInterface, caller data_model.User, subgroupID string, groupID string, keyPaths ...[]string) error

RemoveSubgroupFromGroup removes a subgroup from a group.

subgroupID is the id of the subgroup to remove from group. groupID is the id of the group that the subgroup currently belongs to. keyPaths are optional parameters. If passed in, they are used to get the parent group's keys. The first keyPath is for getting the parent group symKey, and the second keyPath is for getting the parent group privateKey.

func RemoveUserFromGroup

func RemoveUserFromGroup(stub cached_stub.CachedStubInterface, caller data_model.User, args []string) ([]byte, error)

RemoveUserFromGroup removes a user from a group.

args = [userID, groupID, removeSubGroup (optional: default=false)] If removeFromSubGroup is true, the function will also traverse the org tree, and remove the user from all subgroups of the given groupID. This operation could be slow depending on tree structure.

func RemoveUserFromGroupWithParams

func RemoveUserFromGroupWithParams(stub cached_stub.CachedStubInterface, caller data_model.User, userID string, groupID string, keyPaths ...[]string) error

RemoveUserFromGroupWithParams is the internal function for removing a user from a group. "WithParams" functions should only be called from within the chaincode.

func SlowGetGroupAdminIDs

func SlowGetGroupAdminIDs(stub cached_stub.CachedStubInterface, groupID string) ([]string, error)

SlowGetGroupAdminIDs returns a list of group admin IDs. This function searches the entire user graph, so it could be slow.

func SlowGetGroupMemberIDs

func SlowGetGroupMemberIDs(stub cached_stub.CachedStubInterface, groupID string) ([]string, error)

SlowGetGroupMemberIDs returns a list of group member and admin IDs. This function searches the entire user graph, so it could be slow.

func SlowGetMyGroupIDs

func SlowGetMyGroupIDs(stub cached_stub.CachedStubInterface, caller data_model.User, userID string, adminOnly bool) ([]string, error)

SlowGetMyGroupIDs returns a list of group IDs for which the given user is either a direct or indirect member. If adminOnly is set to true, returns only group IDs for which the user is a direct or indirect admin. This function searches the entire user graph, so it could be slow.

func SlowGetSubgroups

func SlowGetSubgroups(stub cached_stub.CachedStubInterface, groupID string) ([]string, error)

SlowGetSubgroups returns a list of subgroup IDs of group's child groups. This function searches the entire user graph, so it could be slow.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL