AVMLockingService is better tested now. Added isAdminAuthority() to

AuthorityService.  Can be removed if this is objectionable.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5887 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2007-06-07 20:20:34 +00:00
parent df8ecd7398
commit 32d169b99b
7 changed files with 200 additions and 21 deletions

View File

@@ -209,8 +209,8 @@ public class AVMLockingServiceImpl implements AVMLockingService
{
for (String authority : lock.getOwners())
{
if (fPersonService.getPerson(authority) == null &&
!fAuthorityService.authorityExists(authority))
if (!fAuthorityService.authorityExists(authority) &&
!fPersonService.personExists(authority))
{
throw new AVMBadArgumentException("Not an Authority: " + authority);
}
@@ -466,8 +466,8 @@ public class AVMLockingServiceImpl implements AVMLockingService
{
for (String user : usersToAdd)
{
if (fPersonService.getPerson(user) == null &&
!fAuthorityService.authorityExists(user))
if (!fAuthorityService.authorityExists(user) &&
!fPersonService.personExists(user))
{
throw new AVMBadArgumentException("Not an authority: " + user);
}
@@ -512,6 +512,10 @@ public class AVMLockingServiceImpl implements AVMLockingService
{
return false;
}
if (fAuthorityService.isAdminAuthority(user))
{
return true;
}
String[] storePath = avmPath.split(":");
if (storePath.length != 2)
{
@@ -527,11 +531,6 @@ public class AVMLockingServiceImpl implements AVMLockingService
{
return false;
}
// TODO is this meaningful? I don't think so.
if (AuthorityType.getAuthorityType(user) == AuthorityType.ADMIN)
{
return true;
}
List<String> owners = lock.getOwners();
for (String owner : owners)
{
@@ -569,4 +568,15 @@ public class AVMLockingServiceImpl implements AVMLockingService
}
return false;
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.avm.locking.AVMLockingService#getWebProjects()
*/
public List<String> getWebProjects()
{
List<String> keys = new ArrayList<String>();
keys.add(LOCK_TABLE);
keys.add(WEB_PROJECTS);
return fAttributeService.getKeys(keys);
}
}