Interface Security


public interface Security
These are the usage of security data and logged in user methods.
Author:
Fred Simon
  • Method Details

    • isUpdatableProfile

      boolean isUpdatableProfile()
      Returns:
      True if the current user can update her profile.
    • isAnonAccessEnabled

      boolean isAnonAccessEnabled()
      Returns:
      True if anonymous access is allowed.
    • canRead

      boolean canRead(RepoPath path)
      Returns:
      True if the current user can read the specified path.
    • canAnnotate

      boolean canAnnotate(RepoPath repoPath)
      Returns:
      True if the current user can annotate the specified path.
    • canDelete

      boolean canDelete(RepoPath path)
      Returns:
      True if the current user can delete the specified path.
    • canDeploy

      boolean canDeploy(RepoPath path)
      Returns:
      True if the current user can deploy to the specified path.
    • canAdmin

      @Deprecated boolean canAdmin(RepoPath path)
      Deprecated.
      Use #canManage() instead
      Returns:
      True if the current user has admin permissions on a target info that includes this path..
    • canManage

      boolean canManage(RepoPath path)
      Returns:
      True if the current user has manage permissions on a target info that includes this path..
    • getCurrentUsername

      String getCurrentUsername()
      Returns:
      The current logged-in user name.
      Since:
      2.3.3
    • currentUsername

      @Deprecated String currentUsername()
      Deprecated.
      The current logged in-user name.
      Returns:
      The current logged in-user name
    • getCurrentUserGroupNames

      String[] getCurrentUserGroupNames()
      The group names for the current logged-in user.
      Returns:
      A list of group names associated with the current user.
      Since:
      2.3.3
    • getCurrentUserGroupNames

      String[] getCurrentUserGroupNames(RealmAwareGroupsSettings settings)
      Retrieves the groups of the current user according to the given realm settings Available realms are LdapGroupsSettings and CrowdGroupsSettings
      Parameters:
      settings - Realm specific settings
      Returns:
      A list of group names associated with the current user with the relevant realm.
      Since:
      4.1.0
    • isAdmin

      boolean isAdmin()
      Returns:
      True if the current is a system administrator.
    • isAnonymous

      boolean isAnonymous()
      Returns:
      True if the current user is a anonymous.
    • isAuthenticated

      boolean isAuthenticated()
      Returns:
      True if a user (anonymous and system are also users) is logged in.
    • getEncryptedPassword

      String getEncryptedPassword()
      Returns:
      The encrypted password of the current user
    • getEscapedEncryptedPassword

      @Deprecated String getEscapedEncryptedPassword()
      Deprecated.
      No need to escape a base58 password
      Used in default settings.xml filtered resource file.
      Returns:
      the encrypted password of the current user, no need for escaping anymore
    • currentUser

      User currentUser()
      Returns:
      The current logged in user, the anonymous user or null if no authentication details present.
    • findUser

      User findUser(String username)
      Accessible only if current user is an admin.
      Returns:
      The user with the given username if exists or null.
      Throws:
      SecurityException - if the current user is not an admin user
    • populateUserProperties

      void populateUserProperties(User user)
      Attaches all the user properties to the given user
      Parameters:
      user - The user to attach properties to
    • updateUser

      void updateUser(User user)
      Update the user with the same username as the user.getUsername() passed.
      NOTE: Only updatable fields will be updated.
      The user object cannot be null, and user.getUsername() should represent an existing non-anonymous or system user. Here are the fields that will be updated and the conditions:
      • user.getEmail() will be updated if not null
      • user.isAdmin() will be updated
      • user.isEnabled() will be updated
      • user.isUpdatableProfile() will be updated
      • user.getPrivateKey() will be updated if not null
      • user.getPublicKey() will be updated if not null
      • user.isTransientUser() will be updated
      • user.getGroups() will be updated if not null and all group name exists
      • user.getBintrayAuth() will be updated if not null
      Parameters:
      user - the user with all the fields to update
      Throws:
      SecurityException - if the current user is not an admin user, if the user passed is the anonymous user, if one of the group passed does not exists
      org.artifactory.storage.StorageException - if the user could not updated