Search in sources :

Example 51 with Group

use of com.agiletec.aps.system.services.group.Group in project entando-core by entando.

the class GroupServiceTest method should_raise_exception_on_delete_reserved_group.

@Test(expected = ValidationConflictException.class)
public void should_raise_exception_on_delete_reserved_group() throws JsonProcessingException {
    Group group = new Group();
    group.setName(Group.ADMINS_GROUP_NAME);
    when(groupManager.getGroup(group.getName())).thenReturn(group);
    this.groupService.removeGroup(group.getName());
}
Also used : Group(com.agiletec.aps.system.services.group.Group) Test(org.junit.Test)

Example 52 with Group

use of com.agiletec.aps.system.services.group.Group in project entando-core by entando.

the class ActivityStreamAction method groupsToStringCode.

private List<String> groupsToStringCode(List<Group> groups) {
    List<String> groupCodes = new ArrayList<String>();
    for (int i = 0; i < groups.size(); i++) {
        Group group = groups.get(i);
        groupCodes.add(group.getName());
    }
    return groupCodes;
}
Also used : Group(com.agiletec.aps.system.services.group.Group) ArrayList(java.util.ArrayList)

Example 53 with Group

use of com.agiletec.aps.system.services.group.Group in project entando-core by entando.

the class ActivityStreamAction method viewMore.

public String viewMore() {
    List<Integer> actionRecordIds = new ArrayList<Integer>();
    try {
        Date timestamp = this.getTimestamp();
        ActivityStreamSeachBean searchBean = new ActivityStreamSeachBean();
        List<Group> userGroups = this.getAuthorizationManager().getUserGroups(this.getCurrentUser());
        searchBean.setUserGroupCodes(groupsToStringCode(userGroups));
        if (timestamp != null) {
            timestamp.setTime(timestamp.getTime() - 100);
        }
        searchBean.setEndCreation(timestamp);
        actionRecordIds = this.getActionLogManager().getActionRecords(searchBean);
    } catch (Throwable t) {
        _logger.error("Error on loading more activities", t);
    }
    this.setActionRecordIds(actionRecordIds);
    return SUCCESS;
}
Also used : Group(com.agiletec.aps.system.services.group.Group) ActivityStreamSeachBean(org.entando.entando.aps.system.services.actionlog.model.ActivityStreamSeachBean) ArrayList(java.util.ArrayList) Date(java.util.Date)

Example 54 with Group

use of com.agiletec.aps.system.services.group.Group in project entando-core by entando.

the class UserAuthorizationAction method getGroups.

public List<Group> getGroups() {
    List<Group> groups = this.getGroupManager().getGroups();
    Collections.sort(groups, new BeanComparator("description"));
    return groups;
}
Also used : Group(com.agiletec.aps.system.services.group.Group) BeanComparator(org.apache.commons.beanutils.BeanComparator)

Example 55 with Group

use of com.agiletec.aps.system.services.group.Group in project entando-core by entando.

the class TestExtendedResourceAction method testNewImageResource_1.

public void testNewImageResource_1() throws Throwable {
    // Contenuto FREE
    this.executeEdit("ART1", "admin");
    String contentOnSessionMarker = super.extractSessionMarker("ART1", ApsAdminSystemConstants.EDIT);
    // iniziazione parametri sessione
    HttpSession session = this.getRequest().getSession();
    session.setAttribute(ResourceAttributeActionHelper.ATTRIBUTE_NAME_SESSION_PARAM, "Foto");
    session.setAttribute(ResourceAttributeActionHelper.RESOURCE_TYPE_CODE_SESSION_PARAM, "Image");
    session.setAttribute(ResourceAttributeActionHelper.RESOURCE_LANG_CODE_SESSION_PARAM, "it");
    this.initContentAction("/do/jacms/Content/Resource", "new", contentOnSessionMarker);
    // per replicare il chain in occasione dei chooseResource da edit Contenuto.
    this.addParameter("resourceTypeCode", "Image");
    String result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
    ExtendedResourceAction action = (ExtendedResourceAction) this.getAction();
    List<Group> allowedGroup = action.getAllowedGroups();
    assertEquals(1, allowedGroup.size());
}
Also used : Group(com.agiletec.aps.system.services.group.Group) HttpSession(javax.servlet.http.HttpSession) ExtendedResourceAction(com.agiletec.plugins.jacms.apsadmin.content.attribute.action.resource.ExtendedResourceAction)

Aggregations

Group (com.agiletec.aps.system.services.group.Group)68 UserDetails (com.agiletec.aps.system.services.user.UserDetails)15 Role (com.agiletec.aps.system.services.role.Role)13 ArrayList (java.util.ArrayList)13 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)7 BeanComparator (org.apache.commons.beanutils.BeanComparator)5 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)4 HashSet (java.util.HashSet)4 RestRourceNotFoundException (org.entando.entando.aps.system.exception.RestRourceNotFoundException)4 RestServerError (org.entando.entando.aps.system.exception.RestServerError)4 IGroupManager (com.agiletec.aps.system.services.group.IGroupManager)3 DataObject (org.entando.entando.aps.system.services.dataobject.model.DataObject)3 AttributeRole (com.agiletec.aps.system.common.entity.model.attribute.AttributeRole)2 SearcherDaoPaginatedResult (com.agiletec.aps.system.common.model.dao.SearcherDaoPaginatedResult)2 Authorization (com.agiletec.aps.system.services.authorization.Authorization)2 IAuthorizationManager (com.agiletec.aps.system.services.authorization.IAuthorizationManager)2 ExtendedResourceAction (com.agiletec.plugins.jacms.apsadmin.content.attribute.action.resource.ExtendedResourceAction)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2