Skip to content
Snippets Groups Projects
Commit 1c64056f authored by cramakri's avatar cramakri
Browse files

BIS-440 SP-695 : Added listUsersForAuthorizationGroup to the authorization service

SVN: 29386
parent 54566de8
No related branches found
No related tags found
No related merge requests found
Showing with 109 additions and 1 deletion
......@@ -17,12 +17,13 @@
package ch.systemsx.cisd.etlserver.registrator.api.v2.impl;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.IAuthorizationGroupImmutable;
import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AuthorizationGroup;
/**
* @author Chandrasekhar Ramakrishnan
*/
public class AuthorizationGroupImmutable implements IAuthorizationGroupImmutable
public class AuthorizationGroupImmutable implements IAuthorizationGroupImmutable, IIdHolder
{
private final AuthorizationGroup authorizationGroup;
......@@ -41,4 +42,10 @@ public class AuthorizationGroupImmutable implements IAuthorizationGroupImmutable
{
return authorizationGroup.getDescription();
}
public Long getId()
{
return authorizationGroup.getId();
}
}
......@@ -25,8 +25,11 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.IAuthorizatio
import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.IDataSetImmutable;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.IExperimentImmutable;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.ISampleImmutable;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.IUserImmutable;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.authorization.IAuthorizationService;
import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AuthorizationGroup;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person;
/**
* @author Jakub Straszewski
......@@ -125,4 +128,18 @@ public class AuthorizationService implements IAuthorizationService
}
return authorizationGroups;
}
@Override
public List<IUserImmutable> listUsersForAuthorizationGroup(IAuthorizationGroupImmutable authorizationGroup)
{
ArrayList<IUserImmutable> users = new ArrayList<IUserImmutable>();
TechId authorizationGroupId = TechId.create((AuthorizationGroupImmutable) authorizationGroup);
List<Person> persons = openBisService.listUsersForAuthorizationGroup(authorizationGroupId);
for (Person person : persons)
{
users.add(new UserImmutable(person));
}
return users;
}
}
/*
* Copyright 2013 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.etlserver.registrator.api.v2.impl;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.IUserImmutable;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person;
/**
* @author Chandrasekhar Ramakrishnan
*/
public class UserImmutable implements IUserImmutable
{
private final Person person;
public UserImmutable(Person person)
{
this.person = person;
}
public String getUserId()
{
return person.getUserId();
}
}
......@@ -955,4 +955,10 @@ public final class EncapsulatedOpenBISService implements IEncapsulatedOpenBISSer
{
return service.listAuthorizationGroupsForUser(session.getSessionToken(), userId);
}
@Override
public List<Person> listUsersForAuthorizationGroup(TechId authorizationGroupId)
{
return service.listUsersForAuthorizationGroup(session.getSessionToken(), authorizationGroupId);
}
}
\ No newline at end of file
......@@ -522,5 +522,11 @@ public interface IEncapsulatedOpenBISService extends IEncapsulatedBasicOpenBISSe
*/
@ManagedAuthentication
public List<AuthorizationGroup> listAuthorizationGroupsForUser(String userId);
/**
* Return the users in a particular authorization group
*/
@ManagedAuthentication
public List<Person> listUsersForAuthorizationGroup(TechId authorizationGroupId);
}
\ No newline at end of file
/*
* Copyright 2013 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2;
/**
* An interface for users (persons) from the database that should not be altered.
*
* @author Chandrasekhar Ramakrishnan
*/
public interface IUserImmutable
{
/** @return The userId of the user */
public String getUserId();
}
......@@ -22,6 +22,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.IAuthorizatio
import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.IDataSetImmutable;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.IExperimentImmutable;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.ISampleImmutable;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.IUserImmutable;
/**
* @author Jakub Straszewski
......@@ -41,4 +42,6 @@ public interface IAuthorizationService
List<IAuthorizationGroupImmutable> listAuthorizationGroupsForUser(String userId);
List<IUserImmutable> listUsersForAuthorizationGroup(IAuthorizationGroupImmutable authorizationGroup);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment