com.atlassian.gadgets.refimpl
Class PermissionServiceImpl

java.lang.Object
  extended by com.atlassian.gadgets.refimpl.PermissionServiceImpl
All Implemented Interfaces:
DashboardPermissionService, DirectoryPermissionService

public class PermissionServiceImpl
extends Object
implements DashboardPermissionService, DirectoryPermissionService

Simple implementation of the permission service. Dashboards with ids less than 1000 are readable and writable by everyone. Dashboards with ids greather than or equal to 1000 and less than 10000 are readable by everyone but writes are restricted to logged in users. Dashboards with ids greater than or equal to 10000 are only readable or writable by logged in users. For tabs, Dashboards with ids greater than 100000 will have 5 tabs (in groups of five). So for example when visiting the dashboard with id 100002, a user will see these tabs: 100000|100001|100002*|100003|100004. Also only tabs with even ids will have write permission. All tabs are readable by logged in users, Accessing dashboard 100002 as a logged in user will display these tabs: 100000|100001|100002*|100003|100004 (however only tabs 100000, 100002 and 100004 are writable)


Constructor Summary
PermissionServiceImpl(com.atlassian.sal.api.user.UserManager userManager)
           
 
Method Summary
 boolean canConfigureDirectory(String username)
          Returns true if the user identified by username has permission to add new external gadgets to the directory, remove external gadgets that were previously added, and otherwise configure the directory.
 boolean isReadableBy(DashboardId dashboardId, String username)
          Returns true if the user identified by username has permission to view the dashboard identified by the DashboardId, false otherwise.
 boolean isWritableBy(DashboardId dashboardId, String username)
          Returns true if the user identified by username has permission to modify the dashboard identified by the DashboardId, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PermissionServiceImpl

public PermissionServiceImpl(com.atlassian.sal.api.user.UserManager userManager)
Method Detail

isReadableBy

public boolean isReadableBy(DashboardId dashboardId,
                            String username)
Description copied from interface: DashboardPermissionService
Returns true if the user identified by username has permission to view the dashboard identified by the DashboardId, false otherwise. This method should also return false if the dashboard specified by the DashboardId doesn't exist.

Specified by:
isReadableBy in interface DashboardPermissionService
Parameters:
dashboardId - the DashboardId of the dashboard the user is trying to view
username - the name of the user logged in, null if no user is currently logged in
Returns:
true if the user identified by username has permission to view the dashboard identified by the DashboardId, false otherwise.

isWritableBy

public boolean isWritableBy(DashboardId dashboardId,
                            String username)
Description copied from interface: DashboardPermissionService
Returns true if the user identified by username has permission to modify the dashboard identified by the DashboardId, false otherwise. This method should also return false if the dashboard specified by the DashboardId doesn't exist.

Specified by:
isWritableBy in interface DashboardPermissionService
Parameters:
dashboardId - the DashboardId of the dashboard the user is trying to modify
username - the name of the user logged in, null if no user is currently logged in
Returns:
true if the user identified by username has permission to modify the dashboard identified by the DashboardId, false otherwise.

canConfigureDirectory

public boolean canConfigureDirectory(String username)
Description copied from interface: DirectoryPermissionService
Returns true if the user identified by username has permission to add new external gadgets to the directory, remove external gadgets that were previously added, and otherwise configure the directory. Returns false if the specified user does not have this permission. Generally, this permission should be restricted to administrators, as gadgets have security considerations that can impact the whole system.

Specified by:
canConfigureDirectory in interface DirectoryPermissionService
Parameters:
username - the name of the user logged in, null if no user is currently logged in
Returns:
true if the user identified by username has permission to configure the directory, false otherwise


Copyright © 2011 Atlassian. All Rights Reserved.