Class ProjectUserBindingsManager

java.lang.Object
it.uniroma2.art.semanticturkey.user.ProjectUserBindingsManager

public class ProjectUserBindingsManager extends Object
  • Constructor Details

    • ProjectUserBindingsManager

      public ProjectUserBindingsManager()
  • Method Details

    • loadPUBindings

      public static void loadPUBindings() throws org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException, IOException, ProjectAccessException
      Loads 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

      public static Collection<ProjectUserBinding> listPUBindings()
      Returns all the project-user bindings
      Returns:
    • getPUBinding

      public static ProjectUserBinding getPUBinding(STUser user, AbstractProject project)
      Returns the ProjectUserBinding that binds the given user and project
      Parameters:
      user -
      project -
      Returns:
    • listPUBindingsOfProject

      public static Collection<ProjectUserBinding> listPUBindingsOfProject(AbstractProject project)
      Returns the ProjectUserBindings of the given project
      Parameters:
      project -
      Returns:
    • existsPUBindingsOfProject

      public static boolean existsPUBindingsOfProject(AbstractProject project)
      Checks if there is the folder of project-user bindings for the given project
      Parameters:
      project -
      Returns:
    • createPUBindingsOfProject

      public static void createPUBindingsOfProject(AbstractProject project)
      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

      public static void deletePUBindingsOfProject(String projectName) throws IOException
      When a project is deleted, deletes all the project-user bindings folders related to the given project
      Parameters:
      projectName -
      Throws:
      IOException
    • createPUBindingsOfUser

      public static void createPUBindingsOfUser(STUser user) throws ProjectAccessException
      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

      public static void deletePUBindingsOfUser(STUser user) throws IOException
      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

      public static 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)
      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

      public static UsersGroup getUserGroup(STUser user, Project project)
      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

      public static File getProjBindingsFolder(AbstractProject project)
      Returns the folder about the given project under /pu_bindings/
      Parameters:
      project -
      Returns:
    • getProjBindingsFolder

      public static File getProjBindingsFolder(String projectName)
      Returns the folder about the given project under /pu_bindings/
      Parameters:
      projectName -
      Returns:
    • getAllProjBindingsFolders

      public static Collection<File> getAllProjBindingsFolders()
      Returns all the projects folder under /pu_bindings/
      Returns:
    • getPUBindingsFolder

      public static File getPUBindingsFolder(AbstractProject project, STUser user)
      Returns the user folders under /pu_bindings// for the given project-user pair
      Parameters:
      project -
      user -
      Returns:
    • getUserBindingsFolders

      public static Collection<File> getUserBindingsFolders(STUser user)
      Returns the user folders under all the /pu_bindings// folders
      Parameters:
      user -
      Returns: