Class ProjectUserBindingsManager
java.lang.Object
it.uniroma2.art.semanticturkey.user.ProjectUserBindingsManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddLanguagesToPUBinding(STUser user, Project project, Collection<String> languages) Adds languages to the binding between the given project-user pairstatic voidaddRolesToPUBinding(STUser user, Project project, Collection<Role> roles) Adds roles to the binding between the given project-user pairstatic voidaddRoleToPUBinding(STUser user, Project project, Role role) Adds role to the binding between the given project-user pairstatic voidassignGroupToPUBinding(STUser user, Project project, UsersGroup group) Assigns a group to the binding between the given project-user pairstatic voidclonePUBinding(STUser sourceUser, Project sourceProject, STUser targetUser, Project targetProject) Clone the PUBinding settings from a project-user pair to another.static voidcreateOrUpdatePUBindingFolder(ProjectUserBinding puBinding) Creates a folder for the given project-user bidning and serializes the details about it in a file.static voidcreatePUBindingsOfProject(Project project) Creates all the project-user bindings folders related to the given project.static voidcreatePUBindingsOfUser(STUser user) Creates all the project-user bindings folders related to the given user.static voiddeletePUBindingsOfProject(String projectName) When a project is deleted, deletes all the project-user bindings folders related to the given projectstatic voiddeletePUBindingsOfUser(STUser user) When a user is deleted, deletes all the project-user bindings folders related to the given userstatic booleanexistsPUBindingsOfProject(Project project) Checks if there is the folder of project-user bindings for the given projectstatic Collection<File>Returns all the projects folder under/pu_bindings/ static FilegetProjBindingsFolder(Project project) Returns the folder about the given project under/pu_bindings/ static FilegetProjBindingsFolder(String projectName) Returns the folder about the given project under/pu_bindings/ static ProjectUserBindinggetPUBinding(STUser user, Project project) Returns the ProjectUserBinding that binds the given user and projectstatic FilegetPUBindingDetailsFile(Project project, STUser user) Returns the binding.tts file of the given puBindingstatic Collection<Role>getPUBindingRoles(STUser user, Project project, boolean includePublic) Returns the role of a user in a given project.static FilegetPUBindingsFolder(Project project, STUser user) Returns the user folders under/pu_bindings/ / for the given project-user pair static Collection<File>getUserBindingsFolders(STUser user) Returns the user folders under all the/pu_bindings/ / folders static UsersGroupgetUserGroup(STUser user, Project project) Returns the UsersGroup which the given user belongs tostatic booleanhasRoleAssignedInProject(STUser user, Project project) Return true if user has a role explicitly assigned in project.static booleanhasUserAccessToProject(AuthenticatedActor actor, Project project) Returns true if user has right to access the project (if it has any role in the given project or if it is admin)static Collection<ProjectUserBinding>Returns all the project-user bindingsstatic Collection<ProjectUserBinding>listPUBindingsOfProject(AbstractProject project) Returns the ProjectUserBindings of the given projectstatic voidLoads all the bindings into the repository Protected since the load should be done just once by AccessControlManager during its initializationstatic voidremoveAllRoleFromPUBinding(STUser user, Project project) Remove all the roles assigned to a user in a projectstatic voidremoveGroupFromPUBinding(STUser user, Project project) Remove the group assigned to the user in the given project-user pairstatic voidremoveRoleFromPUBinding(STUser user, Project project, Role role) Removes a role from the binding between the given project-user pairstatic voidremoveRoleFromPUBindings(Project project, Role role) Removes a role from all the bindings of the given project (useful in case a role is deleted)static voidsetGroupLimitationsToPUBinding(STUser user, Project project, UsersGroup group, boolean limitations) Assigns a group to the binding between the given project-user pairstatic voidupdateLanguagesToPUBinding(STUser user, Project project, Collection<String> languages) Removes a language from the binding between the given project-user pairstatic voidupdateLastConnection(STUser user, Project project, String sessionId)
-
Constructor Details
-
ProjectUserBindingsManager
public ProjectUserBindingsManager()
-
-
Method Details
-
loadPUBindings
public static void loadPUBindings() throws org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException, IOException, ProjectAccessExceptionLoads all the bindings into the repository Protected since the load should be done just once by AccessControlManager during its initialization- Throws:
IOExceptionorg.eclipse.rdf4j.repository.RepositoryExceptionorg.eclipse.rdf4j.rio.RDFParseExceptionProjectAccessException
-
listPUBindings
Returns all the project-user bindings- Returns:
-
getPUBinding
Returns the ProjectUserBinding that binds the given user and project- Parameters:
user-project-- Returns:
-
getPUBindingRoles
public static Collection<Role> getPUBindingRoles(STUser user, Project project, boolean includePublic) Returns the role of a user in a given project.- Parameters:
user-project-includePublic- include PUBLIC lurker role if project visibility is PUBLIC- Returns:
-
listPUBindingsOfProject
Returns the ProjectUserBindings of the given project- Parameters:
project-- Returns:
-
existsPUBindingsOfProject
Checks if there is the folder of project-user bindings for the given project- Parameters:
project-- Returns:
-
createPUBindingsOfProject
Creates all the project-user bindings folders related to the given project. Useful when a project is created/imported and the existing users- Parameters:
project-
-
deletePUBindingsOfProject
When a project is deleted, deletes all the project-user bindings folders related to the given project- Parameters:
projectName-- Throws:
IOException
-
createPUBindingsOfUser
Creates all the project-user bindings folders related to the given user. Useful when a user is created/imported and the existing projects- Parameters:
user-- Throws:
ProjectAccessExceptionIOException
-
deletePUBindingsOfUser
When a user is deleted, deletes all the project-user bindings folders related to the given user- Parameters:
user-- Throws:
IOException
-
addRolesToPUBinding
public static void addRolesToPUBinding(STUser user, Project project, Collection<Role> roles) throws ProjectBindingException Adds roles to the binding between the given project-user pair- Parameters:
user-project-roles-- Throws:
ProjectBindingException
-
addRoleToPUBinding
public static void addRoleToPUBinding(STUser user, Project project, Role role) throws ProjectBindingException Adds role to the binding between the given project-user pair- Parameters:
user-project-role-- Throws:
ProjectBindingException
-
removeRoleFromPUBinding
public static void removeRoleFromPUBinding(STUser user, Project project, Role role) throws ProjectBindingException Removes a role from the binding between the given project-user pair- Parameters:
user-project-role-- Throws:
ProjectBindingException
-
removeAllRoleFromPUBinding
public static void removeAllRoleFromPUBinding(STUser user, Project project) throws ProjectBindingException Remove all the roles assigned to a user in a project- Parameters:
user-project-- Throws:
ProjectBindingException
-
removeRoleFromPUBindings
public static void removeRoleFromPUBindings(Project project, Role role) throws ProjectBindingException Removes a role from all the bindings of the given project (useful in case a role is deleted)- Parameters:
role-- Throws:
ProjectBindingException
-
hasUserAccessToProject
Returns true if user has right to access the project (if it has any role in the given project or if it is admin)- Parameters:
actor-project-- Returns:
-
hasRoleAssignedInProject
Return true if user has a role explicitly assigned in project.- Parameters:
user-project-- Returns:
-
addLanguagesToPUBinding
public static void addLanguagesToPUBinding(STUser user, Project project, Collection<String> languages) throws ProjectBindingException Adds languages to the binding between the given project-user pair- Parameters:
user-project-languages-- Throws:
ProjectBindingException
-
updateLanguagesToPUBinding
public static void updateLanguagesToPUBinding(STUser user, Project project, Collection<String> languages) throws ProjectBindingException Removes a language from the binding between the given project-user pair- Parameters:
user-project-languages-- Throws:
ProjectBindingException
-
assignGroupToPUBinding
public static void assignGroupToPUBinding(STUser user, Project project, UsersGroup group) throws ProjectBindingException Assigns a group to the binding between the given project-user pair- Parameters:
user-project-group-- Throws:
ProjectBindingException
-
setGroupLimitationsToPUBinding
public static void setGroupLimitationsToPUBinding(STUser user, Project project, UsersGroup group, boolean limitations) throws ProjectBindingException Assigns a group to the binding between the given project-user pair- Parameters:
user-project-group-- Throws:
ProjectBindingException
-
removeGroupFromPUBinding
public static void removeGroupFromPUBinding(STUser user, Project project) throws ProjectBindingException Remove the group assigned to the user in the given project-user pair- Parameters:
user-project-- Throws:
ProjectBindingException
-
getUserGroup
Returns the UsersGroup which the given user belongs to- Parameters:
user-project-- Returns:
-
updateLastConnection
public static void updateLastConnection(STUser user, Project project, String sessionId) throws ProjectBindingException - Throws:
ProjectBindingException
-
clonePUBinding
public static void clonePUBinding(STUser sourceUser, Project sourceProject, STUser targetUser, Project targetProject) throws ProjectBindingException Clone the PUBinding settings from a project-user pair to another. The roles project-defined are ignored- Parameters:
sourceUser-targetUser-sourceProject-targetProject-- Throws:
ProjectBindingException
-
createOrUpdatePUBindingFolder
public static void createOrUpdatePUBindingFolder(ProjectUserBinding puBinding) throws ProjectBindingException Creates a folder for the given project-user bidning and serializes the details about it in a file. If the folder is already created, simply update the info in the details file.- Throws:
ProjectBindingException
-
getProjBindingsFolder
Returns the folder about the given project under/pu_bindings/ - Parameters:
project-- Returns:
-
getProjBindingsFolder
Returns the folder about the given project under/pu_bindings/ - Parameters:
projectName-- Returns:
-
getAllProjBindingsFolders
Returns all the projects folder under/pu_bindings/ - Returns:
-
getPUBindingsFolder
Returns the user folders under/pu_bindings/ / for the given project-user pair - Parameters:
project-user-- Returns:
-
getUserBindingsFolders
Returns the user folders under all the/pu_bindings/ / folders - Parameters:
user-- Returns:
-
getPUBindingDetailsFile
Returns the binding.tts file of the given puBinding- Parameters:
project-user-- Returns:
-