Fuego.Fdi : RoleAssignment

An instance of RoleAssignment represents the assignment of an Organizational Role to a Participant or Group. The assignment includes information about the permissions granted to the Participant (or Group) within the Role.

In the case of parametric roles, you define one RoleAssignment for each parametric value that you want to assign.

You add RoleAssignments to Participants and Groups using the DirHumanParticipant.rolesAssignment and DirOrganizationalGroup.rolesAssignment attributes respectively.

Example: Changing Role Assignments For a Participant

This example demonstrates how to fetch all non-parametric Roles and assign them to the current Participant:


// fetch all roles
mySession = DirectorySession.currentEngineSession
allroles = DirOrganizationalRole.fetchAll(session : mySession)

// Generate array of RoleAssignments for all non-parametric Roles
for each r in allroles
do
    aRole = DirOrganizationalRole.fetch(session : mySession, id : r.id)
    if not aRole.parametric then
        newAssignments[] = RoleAssignment.create(role : aRole,
	                                      permissions : 255)
    end
end


// Replace role assignments for this participant
currentPart = DirHumanParticipant.fetch(session : mySession,
                                        id : Participant.id)

currentPart.rolesAssignment = newAssignments

update currentPart
Related reference
Fuego.Fdi : DirHumanParticipant
Fuego.Fdi : DirOrganizationalGroup
Fuego.Fdi : DirOrganizationalRole
Fuego.Fdi : DirectorySession