Class ProjectUserBindingsManager
java.lang.Object
it.uniroma2.art.semanticturkey.user.ProjectUserBindingsManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addLanguagesToPUBinding
(STUser user, AbstractProject project, Collection<String> languages) Adds languages to the binding between the given project-user pairstatic void
addRolesToPUBinding
(STUser user, AbstractProject project, Collection<Role> roles) Adds roles to the binding between the given project-user pairstatic void
addRoleToPUBinding
(STUser user, AbstractProject project, Role role) Adds role to the binding between the given project-user pairstatic void
assignGroupToPUBinding
(STUser user, AbstractProject project, UsersGroup group) Assigns a group to the binding between the given project-user pairstatic void
clonePUBinding
(STUser sourceUser, Project sourceProject, STUser targetUser, Project targetProject) Clone the PUBinding settings from a project-user pair to another.static void
createPUBindingsOfProject
(AbstractProject project) Creates all the project-user bindings folders related to the given project.static void
createPUBindingsOfUser
(STUser user) Creates all the project-user bindings folders related to the given user.static void
deletePUBindingsOfProject
(String projectName) When a project is deleted, deletes all the project-user bindings folders related to the given projectstatic void
deletePUBindingsOfUser
(STUser user) When a user is deleted, deletes all the project-user bindings folders related to the given userstatic boolean
existsPUBindingsOfProject
(AbstractProject 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 File
getProjBindingsFolder
(AbstractProject project) Returns the folder about the given project under/pu_bindings/ static File
getProjBindingsFolder
(String projectName) Returns the folder about the given project under/pu_bindings/ static ProjectUserBinding
getPUBinding
(STUser user, AbstractProject project) Returns the ProjectUserBinding that binds the given user and projectstatic File
getPUBindingsFolder
(AbstractProject 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 UsersGroup
getUserGroup
(STUser user, Project project) Returns the UsersGroup which the given user belongs tostatic boolean
hasUserAccessToProject
(STUser user, 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 void
Loads all the bindings into the repository Protected since the load should be done just once by AccessControlManager during its initializationstatic void
removeAllRoleFromPUBinding
(STUser user, AbstractProject project) Remove all the roles assigned to a user in a projectstatic void
removeGroupFromPUBinding
(STUser user, AbstractProject project) Remove the group assigned to the user in the given project-user pairstatic void
removeRoleFromPUBinding
(STUser user, AbstractProject project, Role role) Removes a role from the binding between the given project-user pairstatic void
removeRoleFromPUBindings
(AbstractProject project, Role role) Removes a role from all the bindings of the given project (useful in case a role is deleted)static void
setGroupLimitationsToPUBinding
(STUser user, AbstractProject project, UsersGroup group, boolean limitations) Assigns a group to the binding between the given project-user pairstatic void
updateLanguagesToPUBinding
(STUser user, AbstractProject project, Collection<String> languages) Removes a language from the binding between the given project-user pair
-
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:
IOException
org.eclipse.rdf4j.repository.RepositoryException
org.eclipse.rdf4j.rio.RDFParseException
ProjectAccessException
-
listPUBindings
Returns all the project-user bindings- Returns:
-
getPUBinding
Returns the ProjectUserBinding that binds the given user and project- Parameters:
user
-project
-- 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:
ProjectAccessException
IOException
-
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, AbstractProject 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, AbstractProject 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, AbstractProject 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, AbstractProject project) throws ProjectBindingException Remove all the roles assigned to a user in a project- Parameters:
user
-project
-- Throws:
ProjectBindingException
-
removeRoleFromPUBindings
public static void removeRoleFromPUBindings(AbstractProject 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:
user
-project
-- Returns:
-
addLanguagesToPUBinding
public static void addLanguagesToPUBinding(STUser user, AbstractProject 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, AbstractProject 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, AbstractProject 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, AbstractProject 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, AbstractProject 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:
-
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
-
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:
-