Class CmsDefaultUsers


  • public class CmsDefaultUsers
    extends java.lang.Object
    Provides access to the names of the OpenCms default users and groups.

    Since:
    6.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsDefaultUsers()
      Constructor that initializes all names with default values.
      CmsDefaultUsers​(java.lang.String userAdmin, java.lang.String userGuest, java.lang.String userExport, java.lang.String userDeletedResource, java.lang.String groupAdministrators, java.lang.String groupUsers, java.lang.String groupGuests)
      Public constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.String getGroupAdministrators()
      Returns the name of the administrators group.
      java.lang.String getGroupGuests()
      Returns the name of the guests group.
      java.lang.String getGroupProjectmanagers()
      Deprecated.
      As of OpenCms 9.5, there is no default group for project managers anymore.
      java.lang.String getGroupUsers()
      Returns the name of the users group.
      java.lang.String getUserAdmin()
      Returns the name of the default administrator user.
      java.lang.String getUserDeletedResource()
      Returns the name of the default deleted resource user.
      java.lang.String getUserExport()
      Returns the name of the user used to generate the static export.
      java.lang.String getUserGuest()
      Returns the name of the default guest user.
      protected void init​(java.lang.String userAdmin, java.lang.String userGuest, java.lang.String userExport, java.lang.String userDeletedResource, java.lang.String groupAdministrators, java.lang.String groupUsers, java.lang.String groupGuests)
      Initializes this instance.
      boolean isDefaultGroup​(java.lang.String groupName)
      Checks if a given group name is the name of one of the OpenCms default groups.
      boolean isDefaultUser​(java.lang.String userName)
      Checks if a given user name is the name of one of the OpenCms default users.
      boolean isGroupGuests​(java.lang.String groupName)
      Checks if a given group name is the name of the guests group.
      boolean isUserAdmin​(java.lang.String userName)
      Checks if a given user name is the name of the admin user.
      boolean isUserExport​(java.lang.String userName)
      Checks if a given user name is the name of the export user.
      boolean isUserGuest​(java.lang.String userName)
      Checks if a given user name is the name of the guest user.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CmsDefaultUsers

        public CmsDefaultUsers()
        Constructor that initializes all names with default values.

        See the constants of this class for the defaule values that are uses.

      • CmsDefaultUsers

        public CmsDefaultUsers​(java.lang.String userAdmin,
                               java.lang.String userGuest,
                               java.lang.String userExport,
                               java.lang.String userDeletedResource,
                               java.lang.String groupAdministrators,
                               java.lang.String groupUsers,
                               java.lang.String groupGuests)
        Public constructor.

        Parameters:
        userAdmin - the name of the default admin user
        userGuest - the name of the guest user
        userExport - the name of the export user
        userDeletedResource - the name of the deleted resource user, can be null
        groupAdministrators - the name of the administrators group
        groupUsers - the name of the users group
        groupGuests - the name of the guests group
    • Method Detail

      • getGroupAdministrators

        public java.lang.String getGroupAdministrators()
        Returns the name of the administrators group.

        Returns:
        the name of the administrators group
      • getGroupGuests

        public java.lang.String getGroupGuests()
        Returns the name of the guests group.

        Returns:
        the name of the guests group
      • getGroupProjectmanagers

        @Deprecated
        public java.lang.String getGroupProjectmanagers()
        Deprecated.
        As of OpenCms 9.5, there is no default group for project managers anymore. Use the role CmsRole.PROJECT_MANAGER instead in case you want a user to be able to manage projects. For backward compatibility in old installations, this returns the old default group name "Projectmanagers".
        Returns the name of the project managers group.

        Returns:
        the name of the project managers group
      • getGroupUsers

        public java.lang.String getGroupUsers()
        Returns the name of the users group.

        Returns:
        the name of the users group
      • getUserAdmin

        public java.lang.String getUserAdmin()
        Returns the name of the default administrator user.

        Returns:
        the name of the default administrator user
      • getUserDeletedResource

        public java.lang.String getUserDeletedResource()
        Returns the name of the default deleted resource user.

        Returns:
        the name of the default deleted resource user
      • getUserExport

        public java.lang.String getUserExport()
        Returns the name of the user used to generate the static export.

        Returns:
        the name of the user used to generate the static export
      • getUserGuest

        public java.lang.String getUserGuest()
        Returns the name of the default guest user.

        Returns:
        the name of the default guest user
      • isDefaultGroup

        public boolean isDefaultGroup​(java.lang.String groupName)
        Checks if a given group name is the name of one of the OpenCms default groups.

        Parameters:
        groupName - the group name to check
        Returns:
        true if group name is one of OpenCms default groups, false if it is not or if groupName is null or an empty string (no trim)
        See Also:
        getGroupAdministrators(), getGroupUsers(), getGroupGuests()
      • isDefaultUser

        public boolean isDefaultUser​(java.lang.String userName)
        Checks if a given user name is the name of one of the OpenCms default users.

        Parameters:
        userName - the group name to check
        Returns:
        true if user name is one of OpenCms default users, false if it is not or if userName is null or an empty string (no trim)
        See Also:
        getUserAdmin(), getUserExport(), getUserGuest(), getUserDeletedResource()
      • isGroupGuests

        public boolean isGroupGuests​(java.lang.String groupName)
        Checks if a given group name is the name of the guests group.

        Parameters:
        groupName - the group name to check
        Returns:
        true if a given group name is the name of the guests group
      • isUserAdmin

        public boolean isUserAdmin​(java.lang.String userName)
        Checks if a given user name is the name of the admin user.

        Parameters:
        userName - the user name to check
        Returns:
        true if a given user name is the name of the admin user
      • isUserExport

        public boolean isUserExport​(java.lang.String userName)
        Checks if a given user name is the name of the export user.

        Parameters:
        userName - the user name to check
        Returns:
        true if a given user name is the name of the export user
      • isUserGuest

        public boolean isUserGuest​(java.lang.String userName)
        Checks if a given user name is the name of the guest user.

        Parameters:
        userName - the user name to check
        Returns:
        true if a given user name is the name of the guest user
      • init

        protected void init​(java.lang.String userAdmin,
                            java.lang.String userGuest,
                            java.lang.String userExport,
                            java.lang.String userDeletedResource,
                            java.lang.String groupAdministrators,
                            java.lang.String groupUsers,
                            java.lang.String groupGuests)
        Initializes this instance.

        Parameters:
        userAdmin - the name of the default admin user
        userGuest - the name of the guest user
        userExport - the name of the export user
        userDeletedResource - the name of the deleted resource user, can be null
        groupAdministrators - the name of the administrators group
        groupUsers - the name of the users group
        groupGuests - the name of the guests group