public abstract class AbstractResource extends PlatformObject implements ITextGridPermission
Constructor and Description |
---|
AbstractResource() |
Modifier and Type | Method and Description |
---|---|
void |
assertPermission(int permission,
String errorMessage,
Object... arguments)
Asserts that the given permissions are available.
|
protected static int |
getNumericPermission(String symbolicPermission)
Translates a single permission string to a numeric value as defined in
ITextGridPermission . |
boolean |
hasPermissions(int rights)
Convenience function that returns true when the user has at least the
given rights on the given resource.
|
int |
retrievePermissions(String resourceID)
Helper method that retrieves the permissions for the ressource identified
by the given ID from TG-auth.
|
getAdapter
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPermissions
public void assertPermission(int permission, String errorMessage, Object... arguments) throws CoreException
ITextGridPermission
assertPermission
in interface ITextGridPermission
permission
- The permission requestederrorMessage
- Error message for the status object constructed when the
permission is not availablearguments
- Arguments for the errorMessage, see
MessageFormat.format(String, Object...)
CoreException
- when the requested permissions are not available, or when
something goes wrong determining them.
FIXME: This is subject to TG-23 refactoring.public boolean hasPermissions(int rights) throws CoreException
ITextGridPermission
hasPermissions
in interface ITextGridPermission
rights
- the requested rights, bitwise or'edCoreException
- with further details when something goes wrong determining
the permissions. FIXME: This is subject to TG-23 refactoring.public int retrievePermissions(String resourceID) throws CoreException
resourceID
- Identifier for the resource, this is a TextGridObject's URI or
a project ID.CoreException
protected static int getNumericPermission(String symbolicPermission)
ITextGridPermission
.symbolicPermission
- ITextGridPermission
or 0 if you pass in an unrecognized string.