none
Report of 'User and Group Permissons' in MDS

    Question

  • Hi

    Is there a report/view to follow up the permissons that have been granted in 'User and Group Permissons' ?

    It's for compare (follow up) the setting in different environments.

    Thanks,

    Monica Morein

    Thursday, September 19, 2013 1:15 PM

Answers

  • There is no in-built report you can create with MDS interface but this is pretty easy to write few lines of code to fetch the principals and privileges from RTA and display in format you want or use it to compare with another instance already deployed.

    Below is few lines of code I scribbled for same purpose which can extract the user rights but instead of displaying I used code to find delta between two env.

     
      public SecurityPrincipals getSecurityPrincipals( string modelName, PrincipalType principalType, object logObj = null)
            {
                SecurityPrincipals principals;
                SecurityPrincipalsGetRequest Request = new SecurityPrincipalsGetRequest();
    
                SecurityPrincipalsGetResponse Response = new SecurityPrincipalsGetResponse();
                Request.Criteria = new SecurityPrincipalsCriteria();
                //Sets the type of principals to return either Group or User
                Request.Criteria.Type = principalType;
                Request.Criteria.ResultType = ResultType.Details;
                Request.Criteria.All = true;
    
                //This sets the result type for each type of security
                //Three Options (Details, Identifiers, and None)
                Request.Criteria.FunctionPrivilege = ResultType.None;
                Request.Criteria.ModelPrivilege = ResultType.None;
                Request.Criteria.HierarchyMemberPrivilege = ResultType.None;
                OperationResult or = _mdsProxy.SecurityPrincipalsGet(new International(), Request.Criteria, out principals);
    
    
              //  bool isException = isOperationException(or, "Importing  Principals");
                if (isException)
                    throw new Exception();
    
                return (principals);
            
            
            }
    
    
            public SecurityPrivileges getSecurityPrivileges(string modelIdentifier, object logObj = null, string principalName = null)
            {
    
    
                try
                {
                    SecurityPrivileges privileges;
                    ModelContextIdentifier modelidentifier = new ModelContextIdentifier();
                    modelidentifier.Name = modelIdentifier;
    
                    SecurityPrivilegesGetCriteria spgc = new SecurityPrivilegesGetCriteria();
                    spgc.FunctionPrivilegesCriteria = new FunctionPrivilegesCriteria()
                    {
                        ResultType = ResultType.Details,
                        PrincipalId = principalName != null ? new Identifier() { Name = principalName } : null,
                    };
    
                    spgc.HierarchyMemberPrivilegesCriteria = new HierarchyMemberPrivilegesCriteria()
                    {
                        ModelId = modelIdentifier != null ? (modelidentifier as Identifier) : null,
                        ResultType = ResultType.Details,
                        PrincipalId = principalName != null ? new Identifier() { Name = principalName } : null
                    };
    
                    spgc.ModelPrivilegesCriteria = new ModelPrivilegesCriteria()
                    {
                        ModelId = modelIdentifier != null ? (modelidentifier as Identifier) : null,
                        ResultType = ResultType.Details,
                        PrincipalId = principalName != null ? new Identifier() { Name = principalName } : null
                    };
    
                    OperationResult or = _mdsProxy.SecurityPrivilegesGet(new International(), spgc, out privileges); //TODO check operation result
                 //   bool isException = isOperationException(or, "Globals.strImportingSecurityPrivileges", logObj);
                    //if (isException)
                    //    throw new Exception();
    
                    return (privileges);
                }
                catch (Exception ex)
                {
    
                    throw ex;
                }
            
            }
    
    
    
            }


    Friday, September 20, 2013 10:08 AM