org.molgenis.omx.auth
Class DatabaseLogin

java.lang.Object
  extended by org.molgenis.omx.auth.DatabaseLogin
All Implemented Interfaces:
Serializable, Login

public class DatabaseLogin
extends Object
implements Login, Serializable

See Also:
Serialized Form

Field Summary
protected  String redirect
           
 
Fields inherited from interface org.molgenis.framework.security.Login
GROUP_SYSTEM_NAME, GROUP_USERS_NAME, USER_ADMIN_NAME, USER_ANONYMOUS_NAME, USER_ANONYMOUS_PASSWORD
 
Constructor Summary
DatabaseLogin(Database db, String redirect, TokenFactory tm)
           
DatabaseLogin(Database db, TokenFactory tm)
          Constructor used to login anonymous
DatabaseLogin(TokenFactory tm)
           
 
Method Summary
 boolean canRead(Class<? extends Entity> entityClass)
          
 boolean canRead(Entity entity)
          Indicates whether the user has permissions to read data from this entity.
 boolean canRead(ScreenController<?> screen)
          
 boolean canReadScreenController(Class<? extends ScreenController<?>> screenControllerClass)
           
 boolean canWrite(Class<? extends Entity> entityClass)
          
 boolean canWrite(Entity entity)
          Indicates whether the user has permissions to write (and read) data from this entity.
 String getFullUserName()
           
 String getRedirect()
           
 QueryRule getRowlevelSecurityFilters(Class<? extends Entity> klazz)
          Deprecated.
 Integer getUserId()
          
 String getUserName()
          
 boolean isAuthenticated()
           Note: Anonymous is automatically logged in but does not count as being authenticated
 boolean isLoginRequired()
          
 boolean login(Database db, String name, String password)
          
 void logout(Database db)
          
 boolean owns(Class<? extends Entity> entityClass)
           
 boolean owns(Entity entity)
           
 void reload(Database db)
          Reloads all permission settings for this user from database.
 void setAdmin(List<? extends Entity> entities, Database db)
           
 void setRedirect(String redirect)
           
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

redirect

protected String redirect
Constructor Detail

DatabaseLogin

public DatabaseLogin(TokenFactory tm)

DatabaseLogin

public DatabaseLogin(Database db,
                     TokenFactory tm)
              throws Exception
Constructor used to login anonymous

Parameters:
db - database to log in to.
Throws:
Exception

DatabaseLogin

public DatabaseLogin(Database db,
                     String redirect,
                     TokenFactory tm)
              throws Exception
Throws:
Exception
Method Detail

getUserId

public Integer getUserId()

Specified by:
getUserId in interface Login

getUserName

public String getUserName()

Specified by:
getUserName in interface Login

getFullUserName

public String getFullUserName()

isAuthenticated

public boolean isAuthenticated()
Note: Anonymous is automatically logged in but does not count as being authenticated

Specified by:
isAuthenticated in interface Login

login

public boolean login(Database db,
                     String name,
                     String password)
              throws Exception

Specified by:
login in interface Login
Throws:
Exception

logout

public void logout(Database db)
            throws Exception

Specified by:
logout in interface Login
Throws:
Exception

reload

public void reload(Database db)
            throws Exception
Reloads all permission settings for this user from database. If user is null, anonymous is logged in. Note: calling reload refreshes the permissions cache map.

Specified by:
reload in interface Login
Throws:
Exception

toString

public String toString()

Overrides:
toString in class Object

isLoginRequired

public boolean isLoginRequired()

Specified by:
isLoginRequired in interface Login

getRowlevelSecurityFilters

public QueryRule getRowlevelSecurityFilters(Class<? extends Entity> klazz)
Deprecated.

Specified by:
getRowlevelSecurityFilters in interface Login

canRead

public boolean canRead(Class<? extends Entity> entityClass)
                throws DatabaseException

Specified by:
canRead in interface Login
Throws:
DatabaseException

canWrite

public boolean canWrite(Class<? extends Entity> entityClass)
                 throws DatabaseException

Specified by:
canWrite in interface Login
Throws:
DatabaseException

owns

public boolean owns(Class<? extends Entity> entityClass)
             throws DatabaseException
Throws:
DatabaseException

canRead

public boolean canRead(Entity entity)
                throws DatabaseException
Indicates whether the user has permissions to read data from this entity. Note: if row-level security is activated, only rows for which the user has been given permission will display.

Specified by:
canRead in interface Login
Parameters:
Entity - the entity to get permission from
Returns:
boolean true if can read, false otherwise
Throws:
DatabaseException
DatabaseException

canWrite

public boolean canWrite(Entity entity)
                 throws DatabaseException
Indicates whether the user has permissions to write (and read) data from this entity. Note: if row-level security is activated, only rows for which the user has been given permission will display as editable.

Specified by:
canWrite in interface Login
Parameters:
Entity - the entity to get permission from
Returns:
boolean true if can write, false otherwise
Throws:
DatabaseException
DatabaseException

owns

public boolean owns(Entity entity)
             throws DatabaseException
Throws:
DatabaseException

canReadScreenController

public boolean canReadScreenController(Class<? extends ScreenController<?>> screenControllerClass)
Specified by:
canReadScreenController in interface Login

canRead

public boolean canRead(ScreenController<?> screen)

Specified by:
canRead in interface Login

getRedirect

public String getRedirect()
Specified by:
getRedirect in interface Login

setAdmin

public void setAdmin(List<? extends Entity> entities,
                     Database db)
              throws DatabaseException
Specified by:
setAdmin in interface Login
Throws:
DatabaseException

setRedirect

public void setRedirect(String redirect)
Specified by:
setRedirect in interface Login


Copyright © 2013. All Rights Reserved.