예제 #1
0
        public DataSet GetUserRoles2(string userValue, string appCodeName, UserValueType userValueType, RightMaskType rightMask, DelegationMaskType delegationMask, bool includeMatrixUsers)
        {
            string[] schemaTypes = SchemaInfo.FilterByCategory("Roles").ToSchemaNames();
            string[] userIDs     = OGUReaderService.SplitObjectValues(userValue);

            SCObjectAndRelationCollection users = OGUReaderService.GetSearchAdapter(GetSearchOUIDType(userValueType), SchemaInfo.FilterByCategory("Users").ToSchemaNames(), userIDs, false).QueryObjectsAndRelations();

            SchemaObjectCollection roles = SCSnapshotAdapter.Instance.QueryUserBelongToRoles(schemaTypes, appCodeName, users.ToIDArray(), false, DateTime.MinValue);

            if (includeMatrixUsers)
            {
                List <string> matachedRoleIDs = GetUserRoleIDsInMatrix(users.ToIDArray(), appCodeName);

                //过滤掉已经在之前查询过的角色
                matachedRoleIDs = matachedRoleIDs.FindAll(rID => roles.ContainsKey(rID) == false);

                if (matachedRoleIDs.Count > 0)
                {
                    InSqlClauseBuilder matrixRoleBuilder = new InSqlClauseBuilder("ID");

                    matrixRoleBuilder.AppendItem(matachedRoleIDs.ToArray());
                    SchemaObjectCollection rolesInMatrix = SchemaObjectAdapter.Instance.Load(matrixRoleBuilder, DateTime.MinValue);

                    rolesInMatrix.ForEach(rMatrix => roles.AddNotExistsItem(rMatrix, (r) => string.Compare(r.ID, rMatrix.ID, true) == 0));
                }
            }

            DataSet ds = new DataSet();

            ds.Tables.Add(QueryHelper.GetAppObjectTableBuilder(schemaTypes).Convert(roles));

            return(ds);
        }
        public DataSet GetFunctionsRoles(string appCodeName, string funcCodeNames)
        {
            string[] schemaTypes         = SchemaInfo.FilterByCategory("Permissions").ToSchemaNames();
            string[] permissionCodeNames = OGUReaderService.SplitObjectValues(funcCodeNames);

            SchemaObjectCollection objs = SCSnapshotAdapter.Instance.QueryPermissionRolesByCodeName(schemaTypes, appCodeName, permissionCodeNames, false, DateTime.MinValue);

            DataSet ds = new DataSet();

            ds.Tables.Add(QueryHelper.GetAppObjectTableBuilder(schemaTypes).Convert(objs));

            return(ds);
        }
        public DataSet GetUserPermissions(string userValue, string appCodeName, UserValueType userValueType, RightMaskType rightMask, DelegationMaskType delegationMask)
        {
            string[] schemaTypes = SchemaInfo.FilterByCategory("Roles").ToSchemaNames();
            string[] userIDs     = OGUReaderService.SplitObjectValues(userValue);

            SCObjectAndRelationCollection users = OGUReaderService.GetSearchAdapter(GetSearchOUIDType(userValueType), SchemaInfo.FilterByCategory("Users").ToSchemaNames(), userIDs, false).QueryObjectsAndRelations();

            SchemaObjectCollection roles = SCSnapshotAdapter.Instance.QueryUserBelongToPermissions(schemaTypes, appCodeName, users.ToIDArray(), false, DateTime.MinValue);

            DataSet ds = new DataSet();

            ds.Tables.Add(QueryHelper.GetAppObjectTableBuilder(schemaTypes).Convert(roles));

            return(ds);
        }
        public DataSet GetChildrenInRoles(string orgRoot, string appCodeName, string roleCodeNames, bool doesMixSort, bool doesSortRank, bool includeDelegate)
        {
            string[] schemaTypes = SchemaInfo.FilterByCategory("Roles").ToSchemaNames();
            string[] roleIDs     = OGUReaderService.SplitObjectValues(roleCodeNames);

            bool removeDuplicateData = GetMethodSettingAttributeValue("GetChildrenInRoles", "removeDuplicateData", false);

            SCObjectAndRelationCollection relations = SCSnapshotAdapter.Instance.QueryRolesContainsMembers(schemaTypes, appCodeName, roleIDs, removeDuplicateData, false, DateTime.MinValue);

            relations.FillDetails();

            DataSet ds = new DataSet();

            ds.Tables.Add(QueryHelper.GetOguTableBuilder(new string[] { "OguObject" }).Convert(relations));

            return(ds);
        }
예제 #5
0
        public DataSet GetUserPermissions2(string userValue, string appCodeName, UserValueType userValueType, RightMaskType rightMask, DelegationMaskType delegationMask, bool includeMatrixUsers)
        {
            string[] schemaTypes = SchemaInfo.FilterByCategory("Roles").ToSchemaNames();
            string[] userIDs     = OGUReaderService.SplitObjectValues(userValue);

            SCObjectAndRelationCollection users = OGUReaderService.GetSearchAdapter(GetSearchOUIDType(userValueType), SchemaInfo.FilterByCategory("Users").ToSchemaNames(), userIDs, false).QueryObjectsAndRelations();

            SchemaObjectCollection permissions = SCSnapshotAdapter.Instance.QueryUserBelongToPermissions(schemaTypes, appCodeName, users.ToIDArray(), false, DateTime.MinValue);

            if (includeMatrixUsers)
            {
                string[] permissionTypes = SchemaInfo.FilterByCategory("Permissions").ToSchemaNames();

                List <string> roleIDsInMatrix = GetUserRoleIDsInMatrix(users.ToIDArray(), appCodeName);

                SCObjectAndRelationCollection permissionsInMatrixRelation = SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(permissionTypes, roleIDsInMatrix.ToArray(), false, true, false, DateTime.MinValue);

                InSqlClauseBuilder inBuilder = new InSqlClauseBuilder("ID");

                List <string> permissionInMatrixIDs = new List <string>();

                foreach (SCObjectAndRelation pim in permissionsInMatrixRelation)
                {
                    if (permissions.ContainsKey(pim.ID) == false)
                    {
                        inBuilder.AppendItem(pim.ID);
                    }
                }

                if (inBuilder.IsEmpty == false)
                {
                    SchemaObjectCollection permissionsInMatrix = SchemaObjectAdapter.Instance.Load(inBuilder, DateTime.MinValue);

                    permissions.CopyFrom(permissionsInMatrix);
                }
            }

            DataSet ds = new DataSet();

            ds.Tables.Add(QueryHelper.GetAppObjectTableBuilder(schemaTypes).Convert(permissions));

            return(ds);
        }
예제 #6
0
        public DataSet GetRolesUsers2(string orgRoot, string appCodeName, string roleCodeNames, DelegationMaskType delegationMask, SidelineMaskType sidelineMask, string extAttr, bool includeMatrixUsers)
        {
            string[] schemaTypes = SchemaInfo.FilterByCategory("Roles").ToSchemaNames();
            string[] roleIDs     = OGUReaderService.SplitObjectValues(roleCodeNames);

            bool removeDuplicateData = GetMethodSettingAttributeValue("GetChildrenInRoles", "removeDuplicateData", false);

            SCObjectAndRelationCollection relations = SCSnapshotAdapter.Instance.QueryRolesContainsUsers(schemaTypes, appCodeName, roleIDs, removeDuplicateData, false, DateTime.MinValue);

            if (includeMatrixUsers)
            {
                FillRoleMatrixRelations(relations, schemaTypes, roleIDs);
            }

            relations.FillDetails();

            DataSet ds = new DataSet();

            ds.Tables.Add(QueryHelper.GetOguTableBuilder(SchemaInfo.FilterByCategory("Users").ToSchemaNames()).Convert(relations));

            return(ds);
        }