Package edu.stanford.bmir.protege.web.client.rpc.data

Examples of edu.stanford.bmir.protege.web.client.rpc.data.AccessPolicyUserData


    // TODO !!!! WHY ARE THERE EMPTY CATCH BLOCKS HERE?
    public Collection<AccessPolicyUserData> getUsersWithReadOnlyAccess(ProjectId projectId, boolean includeTemporaryAccount) {
        try {
            MetaProject metaProject = MetaProjectManager.getManager().getMetaProject();

            Collection<AccessPolicyUserData> userList = new TreeSet<AccessPolicyUserData>(new AccessPolicyUserData());
            ProjectInstance projectInstance = getProjectInstance(projectId, metaProject);
            Operation readOnlyOperation = metaProject.getOperation(OntologyShareAccessConstants.PROJECT_READ_ONLY_ACCESS_OPERATION);
            Set<GroupOperation> groupOperations = projectInstance.getAllowedGroupOperations();
            Set<User> allPoliciesUsers = new HashSet<User>();

            if (isUsersFromDefaultPolicy(groupOperations, readOnlyOperation)) {
                AccessPolicyUserData userEveryBodyUserData = new AccessPolicyUserData();
                userEveryBodyUserData.setName(OntologyShareAccessConstants.USER_EVERYBODY_NAME);
                userList.add(userEveryBodyUserData);
                return userList;
            }

            if (groupOperations != null) {
View Full Code Here


    public Collection<AccessPolicyUserData> getUsersWithWriteAccess(ProjectId projectId, boolean includeTemporaryAccount) {

        try {
            MetaProject metaProject = MetaProjectManager.getManager().getMetaProject();

            Collection<AccessPolicyUserData> userList = new TreeSet<AccessPolicyUserData>(new AccessPolicyUserData());
            ProjectInstance projectInstance = getProjectInstance(projectId, metaProject);
            Policy policy = metaProject.getPolicy();
            Operation writeOperation = metaProject.getOperation(OntologyShareAccessConstants.PROJECT_WRITE_ACCESS_OPERATION);
            Set<GroupOperation> groupOperations = projectInstance.getAllowedGroupOperations();
            Set<User> allPoliciesUsers = new HashSet<User>();

            if (isUsersFromDefaultPolicy(groupOperations, writeOperation)) {
                AccessPolicyUserData userEveryBodyUserData = new AccessPolicyUserData();
                userEveryBodyUserData.setName(OntologyShareAccessConstants.USER_EVERYBODY_NAME);
                userList.add(userEveryBodyUserData);
                return userList;
            }

            if (groupOperations != null) {
                for (GroupOperation groupOperation1 : groupOperations) {
                    try {
                        GroupOperation groupOperation = groupOperation1;
                        Group group = groupOperation.getAllowedGroup();
                        if (group.getMembers() != null) {
                            allPoliciesUsers.addAll(group.getMembers());
                        }
                    }
                    catch (Exception e) {
                    }

                }
            }
            Group group = metaProject.getGroup(projectId.getId() + OntologyShareAccessConstants.ONTOLOGY_WRITERS_GROUP_SUFFIX);
            List<String> groupUserList = getUserListForGroupOperation(projectInstance, group, writeOperation);
            for (User user : allPoliciesUsers) {
                if (user.getName() != null && policy.isOperationAuthorized(user, writeOperation, projectInstance)) {
                    if (includeTemporaryAccount || user.getPropertyValue(InvitationConstants.USER_PROPERTY_IS_TEMPORARY_ACCOUNT) == null || !user.getPropertyValue(InvitationConstants.USER_PROPERTY_IS_TEMPORARY_ACCOUNT).trim().equals("true")) { // Proceed if account is not temporary.
                        AccessPolicyUserData userData = new AccessPolicyUserData();
                        userData.setName(user.getName());
                        if (groupUserList.contains(user.getName())) {
                            userData.setPartofWriters(true);
                        }
                        try {
                            userList.add(userData);
                        }
                        catch (Exception e) {
View Full Code Here

        user.removePropertyValue(InvitationConstants.USER_PROPERTY_TEMPORARY_ACCOUNT_RANDOM_NO, invitationRandomNo);

        String invitationDate = user.getPropertyValue(InvitationConstants.USER_PROPERTY_ACCOUNT_INVITATION_DATE);
        user.removePropertyValue(InvitationConstants.USER_PROPERTY_ACCOUNT_INVITATION_DATE, invitationDate);
        OWLAPIMetaProjectStore.getStore().saveMetaProject(MetaProjectManager.getManager());
        return new AccessPolicyUserData(name, null);
    }
View Full Code Here

TOP

Related Classes of edu.stanford.bmir.protege.web.client.rpc.data.AccessPolicyUserData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.