001    package de.deepamehta.core.service.accesscontrol;
002    
003    import de.deepamehta.core.DeepaMehtaObject;
004    
005    
006    
007    public interface AccessControl {
008    
009        boolean checkCredentials(Credentials cred);
010    
011        /**
012         * Checks if a user is permitted to perform an operation on an object (topic or association).
013         *
014         * @param   username    the logged in user, or <code>null</code> if no user is logged in.
015         * @param   objectId    a topic ID, or an association ID.
016         *
017         * @return  <code>true</code> if permission is granted, <code>false</code> otherwise.
018         */
019        boolean hasPermission(String username, Operation operation, long objectId);
020    
021        /**
022         * Checks if a user is a member of a given workspace.
023         *
024         * @param   username    the logged in user, or <code>null</code> if no user is logged in.
025         */
026        boolean isMember(String username, long workspaceId);
027    
028        void assignToWorkspace(DeepaMehtaObject object, long workspaceId);
029    }