Example #1
0
        public List <string> GetPermissionGroupBackLink(RmGroup group)
        {
            List <string> retVal = new List <string>();

            foreach (RmRole role in Base_GetResourceByAttribute(RmRole.StaticResourceType(), RmRole.AttributeNames.PremissionRefs.Name, group.ObjectID.Value,
                                                                OperationType.Opration_Is, new string[] { RmResource.AttributeNames.ObjectID.Name }))
            {
                if (role != null)
                {
                    foreach (RmPerson person in Base_GetResourceByAttribute(RmPerson.StaticResourceType(), RmPerson.AttributeNames.RoleRefList.Name,
                                                                            role.ObjectID.Value, OperationType.Opration_Is, new string[] { RmResource.AttributeNames.ObjectID.Name }))
                    {
                        if (person != null)
                        {
                            if (!retVal.Contains(person.ObjectID.Value))
                            {
                                retVal.Add(person.ObjectID.Value);
                            }
                        }
                    }
                }
            }

            return(retVal);
        }
Example #2
0
        public List <RmRole> GetAllAvailableRoles(string personID, string[] attributes)
        {
            List <RmRole> retVal     = new List <RmRole>();
            List <string> roleIDList = new List <string>();

            foreach (RmOrgAssignment ouAssignment in Base_GetResourceByAttribute(
                         RmOrgAssignment.StaticResourceType(),
                         RmOrgAssignment.AttributeNames.AssignedUser.Name,
                         personID,
                         OperationType.Opration_Is,
                         new string[] { RmOrgAssignment.AttributeNames.AssignedOrgUnit.Name }))
            {
                if (ouAssignment != null)
                {
                    RmOrgUnit ou = Base_GetResourceById(RmOrgUnit.StaticResourceType(), ouAssignment.AssignedOrgUnit.Value,
                                                        new string[] { RmOrgUnit.AttributeNames.RoleRefList.Name }) as RmOrgUnit;
                    if (ou != null && ou.RoleRefList != null)
                    {
                        foreach (RmReference roleRef in ou.RoleRefList)
                        {
                            if (roleRef != null)
                            {
                                if (!roleIDList.Contains(roleRef.Value))
                                {
                                    RmRole role = Base_GetResourceById(RmRole.StaticResourceType(), roleRef.Value, attributes) as RmRole;
                                    if (role != null)
                                    {
                                        retVal.Add(role);
                                        roleIDList.Add(role.ObjectID.Value);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(retVal);
        }
Example #3
0
        public List <RmRole> GetAllOptionalRoles(string personID, string[] attributes)
        {
            List <RmRole> retVal = new List <RmRole>();

            foreach (RmOrgAssignment ouAssignment in Base_GetResourceByAttribute(
                         RmOrgAssignment.StaticResourceType(),
                         RmOrgAssignment.AttributeNames.AssignedUser.Name,
                         personID,
                         OperationType.Opration_Is,
                         new string[] { RmOrgAssignment.AttributeNames.AssignedOrgUnit.Name }))
            {
                if (ouAssignment != null)
                {
                    string filter = string.Format("[{0}='{1}' and {2}=/{3}/{4}]",
                                                  RmOrgAssignment.AttributeNames.AssignedOrgUnit,
                                                  ouAssignment.AssignedOrgUnit.Value,
                                                  RmOrgAssignment.AttributeNames.AssignedRole.Name,
                                                  RmOrgAssignment.StaticResourceType(),
                                                  RmOrgAssignment.AttributeNames.AssignedRole.Name);
                    foreach (RmOrgAssignment roleAssignment in Base_GetResourceByQuery(
                                 RmOrgAssignment.StaticResourceType(),
                                 filter,
                                 new string[] { RmOrgAssignment.AttributeNames.AssignedRole.Name, RmOrgAssignment.AttributeNames.IsMandatory.Name }))
                    {
                        if (roleAssignment != null && !roleAssignment.IsMandatory)
                        {
                            RmRole role = Base_GetResourceById(RmRole.StaticResourceType(), roleAssignment.AssignedRole.Value, attributes) as RmRole;
                            if (role != null)
                            {
                                retVal.Add(role);
                            }
                        }
                    }
                }
            }

            return(retVal);
        }
Example #4
0
        public List <RmRole> GetAssignedRoles(RmGroup group, string[] attributes)
        {
            List <RmRole> retVal = new List <RmRole>();

            foreach (RmUserAssignment assignment in Base_GetResourceByAttribute(
                         RmUserAssignment.StaticResourceType(),
                         RmUserAssignment.AttributeNames.AssignedUser.Name,
                         group.ObjectID.Value,
                         OperationType.Opration_Is,
                         new string[] { RmUserAssignment.AttributeNames.AssignedRole.Name }))
            {
                RmRole role = Base_GetResourceById(RmRole.StaticResourceType(), assignment.AssignedRole.Value, attributes) as RmRole;

                if (role != null)
                {
                    if (!retVal.Any(r => r.ObjectID.Value == role.ObjectID.Value))
                    {
                        retVal.Add(role);
                    }
                }
            }

            return(retVal);
        }
Example #5
0
        public List <RmRole> GetRoleByQuery(string query, string[] attributes)
        {
            List <RmResource> resourceList = Base_GetResourceByQuery(RmRole.StaticResourceType(), query, attributes);

            return(resourceList.ConvertAll <RmRole>(delegate(RmResource r) { return r as RmRole; }));
        }
Example #6
0
        public List <RmRole> GetRoleByAttribute(string attributeName, string value, OperationType operation, string[] attributes)
        {
            List <RmResource> resourceList = Base_GetResourceByAttribute(RmRole.StaticResourceType(), attributeName, value, operation, attributes);

            return(resourceList.ConvertAll <RmRole>(delegate(RmResource r) { return r as RmRole; }));
        }
Example #7
0
 public RmRole GetRoleById(string objectId, string[] attributes)
 {
     return(Base_GetResourceById(RmRole.StaticResourceType(), objectId, attributes) as RmRole);
 }
Example #8
0
 public RmRole GetRoleByDisplayName(string displayName, string[] attributes)
 {
     return(Base_GetResourceByDisplayName(RmRole.StaticResourceType(), displayName, attributes) as RmRole);
 }