|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.basedb.core.ProjectPermissions
public final class ProjectPermissions
This class is used to specify permissions to share an item to projects. It is a three-step procedure:
ProjectKey using this object as the
input parameter to ProjectKey.getNewOrExisting(DbControl, ProjectPermissions)
Shareable.setProjectKey(ProjectKey)
NOTE! As of BASE 2.6 this class is final because of a security issue. Existing code that has subclassed this class will no longer work. There is no workaround.
ProjectKey| Field Summary | |
|---|---|
private Map<ProjectData,Integer> |
originalPermissions
|
private Map<ProjectData,Integer> |
projectPermissions
|
| Constructor Summary | |
|---|---|
ProjectPermissions()
Create a new empty object. |
|
ProjectPermissions(ProjectKey projectKey)
Create a new object, and initialise it with the permissions from a ProjectKey. |
|
| Method Summary | |
|---|---|
void |
addPermissions(Project project,
Set<Permission> permissions)
Grant permissions to a project, keeping those that have already been set. |
(package private) Map<ProjectData,Integer> |
getOriginalPermissions()
Get the internal representation of the original permissions. |
Set<Permission> |
getOriginalPermissions(Project project)
Get the original permissions for a project if this object was created with the ProjectPermissions(ProjectKey) constructor. |
Set<Permission> |
getPermissions(Project project)
Get the permissions for a project. |
(package private) Map<ProjectData,Integer> |
getProjectPermissions()
Get the internal representation of the permissions. |
boolean |
hasChanged(Project project)
Check if the current permissions for the project has been changed from the original permissions. |
void |
merge(ProjectKey projectKey)
Merge the permissions for all projects from the given project key with the permissions in this object. |
void |
setPermissions(Project project,
Set<Permission> permissions)
Grant permissions to a project. |
int |
size()
Get the number of entries. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final Map<ProjectData,Integer> projectPermissions
private final Map<ProjectData,Integer> originalPermissions
| Constructor Detail |
|---|
public ProjectPermissions()
public ProjectPermissions(ProjectKey projectKey)
throws InvalidDataException
ProjectKey.
projectKey - The project key from which we take the current permissions
InvalidDataException - If the project key is null| Method Detail |
|---|
public void merge(ProjectKey projectKey)
projectKey - A project key (if null, this method simply returns)
public void setPermissions(Project project,
Set<Permission> permissions)
throws PermissionDeniedException,
InvalidDataException
Set or null
to remove all permissions for the project.
project - The Projectpermissions - The permissions to grant
PermissionDeniedException - If the logged in user doesn't have
Permission.USE permission for the project
InvalidDataException - If the project is nullPermission
public void addPermissions(Project project,
Set<Permission> permissions)
throws PermissionDeniedException,
InvalidDataException
project - The Projectpermissions - The permissions to grant
PermissionDeniedException - If the logged in user doesn't have
Permission.USE permission for the project
InvalidDataException - If the project is nullPermission
public Set<Permission> getPermissions(Project project)
throws InvalidDataException
project - The Project for which we want to get the permission
Set containing the granted permissions, or an
empty set if no permissions have been granted
InvalidDataException - If the project is nullgetOriginalPermissions(Project),
Permissionpublic Set<Permission> getOriginalPermissions(Project project)
ProjectPermissions(ProjectKey) constructor.
project - The Project for which we want to get the permission
Set containing the original permissions, or an
empty set
InvalidDataException - If the project is nullgetPermissions(Project)public boolean hasChanged(Project project)
getPermissions(Project)
returns a set with the same permissions getOriginalPermissions(Project).
project - The project to check
InvalidDataException - If the project is nullpublic int size()
final Map<ProjectData,Integer> getProjectPermissions()
final Map<ProjectData,Integer> getOriginalPermissions()
|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||