Search in sources :

Example 56 with Group

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

the class ContentAction method joinGroup.

/**
 * Esegue l'azione di associazione di un gruppo al contenuto in fase di
 * redazione.
 *
 * @return Il codice del risultato dell'azione.
 */
public String joinGroup() {
    this.updateContentOnSession();
    try {
        String extraGroupName = this.getExtraGroupName();
        Group group = this.getGroupManager().getGroup(extraGroupName);
        if (null != group) {
            this.getContent().addGroup(extraGroupName);
        }
    } catch (Throwable t) {
        _logger.error("error in joinGroup", t);
        return FAILURE;
    }
    return SUCCESS;
}
Also used : Group(com.agiletec.aps.system.services.group.Group)

Example 57 with Group

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

the class PageAction method getGroups.

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

Example 58 with Group

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

the class BaseAction method getActualAllowedGroups.

protected List<Group> getActualAllowedGroups() {
    if (null != this._actualAllowedGroups) {
        return _actualAllowedGroups;
    }
    this._actualAllowedGroups = new ArrayList<Group>();
    UserDetails currentUser = this.getCurrentUser();
    if (null == currentUser || null == this.getRequiredPermissions()) {
        return this._actualAllowedGroups;
    }
    Iterator<String> iter = this.getRequiredPermissions().iterator();
    while (iter.hasNext()) {
        String permissionName = iter.next();
        List<Group> groupsByPermission = this.getAuthorizationManager().getGroupsByPermission(currentUser, permissionName);
        if (null != groupsByPermission) {
            for (int i = 0; i < groupsByPermission.size(); i++) {
                Group group = groupsByPermission.get(i);
                if (null != group && !this._actualAllowedGroups.contains(group)) {
                    this._actualAllowedGroups.add(group);
                }
            }
        }
    }
    Collections.sort(this._actualAllowedGroups, new BeanComparator("description"));
    return this._actualAllowedGroups;
}
Also used : Group(com.agiletec.aps.system.services.group.Group) UserDetails(com.agiletec.aps.system.services.user.UserDetails) BeanComparator(org.apache.commons.beanutils.BeanComparator)

Example 59 with Group

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

the class GroupAction method extractGroupFormValues.

protected String extractGroupFormValues() {
    try {
        if (!this.existsGroup()) {
            this.addActionError(this.getText("error.group.notExist"));
            return "groupList";
        }
        Group group = this.getGroupManager().getGroup(this.getName());
        this.setName(group.getName());
        this.setDescription(group.getDescr());
    } catch (Throwable t) {
        _logger.error("error in extractGroupFormValues", t);
        return FAILURE;
    }
    return SUCCESS;
}
Also used : Group(com.agiletec.aps.system.services.group.Group)

Example 60 with Group

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

the class GroupAction method save.

public String save() {
    try {
        Group group = new Group();
        group.setName(this.getName());
        group.setDescr(this.getDescription());
        if (this.getStrutsAction() == ApsAdminSystemConstants.ADD) {
            this.getGroupManager().addGroup(group);
        } else if (this.getStrutsAction() == ApsAdminSystemConstants.EDIT) {
            this.getGroupManager().updateGroup(group);
        }
    } catch (Throwable t) {
        _logger.error("error in save", t);
        return FAILURE;
    }
    return SUCCESS;
}
Also used : Group(com.agiletec.aps.system.services.group.Group)

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