Class SecurityServiceImpl

  • All Implemented Interfaces:
    com.google.gwt.user.client.rpc.RemoteService, com.google.gwt.user.server.rpc.SerializationPolicyProvider, SecurityService, Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class SecurityServiceImpl
    extends com.google.gwt.user.server.rpc.RemoteServiceServlet
    implements SecurityService
    Implementation of the SecurityService
    Since:
    6.0
    Author:
    Marco Meschieri - LogicalDOC
    See Also:
    Serialized Form
    • Constructor Detail

      • SecurityServiceImpl

        public SecurityServiceImpl()
    • Method Detail

      • getTenant

        public static GUITenant getTenant​(long tenantId)
      • loadSession

        public GUISession loadSession​(Session sess,
                                      String locale)
        Used internally by login procedures, instantiates a new GUISession by a given authenticated user
        Parameters:
        sess - the current session
        locale - the current locale
        Returns:
        session details
      • getSession

        public GUISession getSession​(String locale)
        Description copied from interface: SecurityService
        Logs-in a user by an existing session ID (session reuse)
        Specified by:
        getSession in interface SecurityService
        Parameters:
        locale - the currently used language specification
        Returns:
        session informations
      • changePassword

        public GUIValue changePassword​(Long requestorUserId,
                                       long userId,
                                       String oldPassword,
                                       String newPassword,
                                       boolean notify)
        Description copied from interface: SecurityService
        Changes the password of a user
        Specified by:
        changePassword in interface SecurityService
        Parameters:
        requestorUserId - The user Identifier of the requestor
        userId - The user Identifier
        oldPassword - can be null
        newPassword - the new password
        notify - If the new credentials have to be notified
        Returns:
        the error code and message. 0 if all went ok, 1 if the password is incorrect, 2 if the new password cannot be notified, 3 if the password has been already used, otherwise a positive number grater than 3
      • addUserToGroup

        public void addUserToGroup​(long groupId,
                                   long userId)
                            throws ServerException
        Description copied from interface: SecurityService
        Adds a user to a group
        Specified by:
        addUserToGroup in interface SecurityService
        Parameters:
        groupId - identifier of the group
        userId - identifier of the user
        Throws:
        ServerException - error generated in the server application
      • getGroup

        public GUIGroup getGroup​(long groupId)
                          throws ServerException
        Description copied from interface: SecurityService
        Loads a given group from the database
        Specified by:
        getGroup in interface SecurityService
        Parameters:
        groupId - identifier of the group
        Returns:
        group retrieved from the server application
        Throws:
        ServerException - error generated in the server application
      • getUser

        public GUIUser getUser​(long userId)
                        throws ServerException
        Description copied from interface: SecurityService
        Loads a given user from the database
        Specified by:
        getUser in interface SecurityService
        Parameters:
        userId - identifier of the user
        Returns:
        the user retrieved from the server application
        Throws:
        ServerException - error generated in the server application
      • removeFromGroup

        public void removeFromGroup​(long groupId,
                                    long[] userIds)
                             throws ServerException
        Description copied from interface: SecurityService
        Removes users from a group
        Specified by:
        removeFromGroup in interface SecurityService
        Parameters:
        groupId - identifier of the group
        userIds - array of user identifiers
        Throws:
        ServerException - error generated in the server application
      • kill

        public void kill​(String sid)
        Description copied from interface: SecurityService
        Kill the session with the given sid
        Specified by:
        kill in interface SecurityService
        Parameters:
        sid - identifier of the session
      • deleteMenu

        public void deleteMenu​(long menuId)
                        throws ServerException
        Description copied from interface: SecurityService
        Deletes a menu but only if is not a legacy menu (type not 0)
        Specified by:
        deleteMenu in interface SecurityService
        Parameters:
        menuId - the menu to delete
        Throws:
        ServerException - error generated in the server application
      • getMenus

        public GUIMenu[] getMenus​(long parentId,
                                  String locale,
                                  boolean enabledOnly)
                           throws ServerException
        Description copied from interface: SecurityService
        Retrieves the accessible menus children of a given parent
        Specified by:
        getMenus in interface SecurityService
        Parameters:
        parentId - identifier of the parent menu
        locale - currently selected locale
        enabledOnly - to retrieve just the enabled menus
        Returns:
        the accessible children
        Throws:
        ServerException - error generated in the server application
      • getMenu

        public GUIMenu getMenu​(long menuId,
                               String locale)
                        throws ServerException
        Description copied from interface: SecurityService
        Retrieves the specified menu
        Specified by:
        getMenu in interface SecurityService
        Parameters:
        menuId - identifier of the menu
        locale - currently selected locale
        Returns:
        the menu retrieved from the server application
        Throws:
        ServerException - error generated in the server application
      • replicateUsersSettings

        public void replicateUsersSettings​(long masterUserId,
                                           Long[] userIds,
                                           boolean gui,
                                           boolean groups)
                                    throws ServerException
        Description copied from interface: SecurityService
        Replicates the settings of a given user to a selection of other users
        Specified by:
        replicateUsersSettings in interface SecurityService
        Parameters:
        masterUserId - identifier of the user with the settings you want to replicate
        userIds - identifiers of the users to replicate the settings to
        gui - if the user interface settings must be replicated
        groups - if the groups must be replicated(the read-only users will not be affected by this flag)
        Throws:
        ServerException - error generated in the server application
      • updateDeviceLabel

        public void updateDeviceLabel​(long deviceId,
                                      String label)
                               throws ServerException
        Description copied from interface: SecurityService
        Updates the label of a device
        Specified by:
        updateDeviceLabel in interface SecurityService
        Parameters:
        deviceId - identifier of the device to update
        label - label to assign to the current device
        Throws:
        ServerException - error generated in the server application
      • trustDevice

        public String trustDevice​(String label)
                           throws ServerException
        Description copied from interface: SecurityService
        Permanently trusts the current device for the current user
        Specified by:
        trustDevice in interface SecurityService
        Parameters:
        label - optional label to assign to the current device
        Returns:
        the ID of the trusted device
        Throws:
        ServerException - error generated in the server application
      • cloneWorkTimes

        public void cloneWorkTimes​(long srcUserId,
                                   long[] userIds,
                                   long[] groupIds)
                            throws ServerException
        Description copied from interface: SecurityService
        Clones a work time to a set of other users
        Specified by:
        cloneWorkTimes in interface SecurityService
        Parameters:
        srcUserId - identifier of the user with the work time you want to clone
        userIds - direct ids of users to clone the working time to
        groupIds - the groups of users to clone the working time to
        Throws:
        ServerException - generic error
      • changeStatus

        public void changeStatus​(long userId,
                                 boolean enabled)
                          throws ServerException
        Description copied from interface: SecurityService
        Changes the status of a user
        Specified by:
        changeStatus in interface SecurityService
        Parameters:
        userId - The user Identifier
        enabled - If the user must be enabled or not
        Throws:
        ServerException - error generated in the server application