コード例 #1
0
        protected virtual List <object> GetGroupSIDs(BPMConnection cn, string groupName)
        {
            List <object> sids = new List <object>();

            SIDPairCollection sidPairs = GroupManager.GetSecurityGroupSIDs(cn, groupName);

            foreach (SIDPair sid in sidPairs)
            {
                string displayName = SecurityManager.TryGetObjectNameFromSID(cn, sid.SIDType, sid.SID);
                if (String.IsNullOrEmpty(displayName))
                {
                    continue;
                }

                sids.Add(
                    new
                {
                    SIDType     = sid.SIDType.ToString(),
                    SID         = sid.SID,
                    DisplayName = displayName
                }
                    );
            }

            return(sids);
        }
コード例 #2
0
ファイル: RecordAccessControl.cs プロジェクト: radtek/EMIP
        public virtual JObject Public(HttpContext context)
        {
            YZRequest request         = new YZRequest(context);
            int       count           = request.GetInt32("Count");
            int       sidCount        = request.GetInt32("SIDCount");
            string    dataSource      = request.GetString("DataSource", null);
            string    rsid            = request.GetString("RSID");
            string    publicPermision = request.GetString("PublicPerm");
            bool      leadershipToken = request.GetBool("LeadershipToken", false);
            string    comments        = request.GetString("Comments", null);

            JArray processedItems = new JArray();

            BPMObjectNameCollection permisions = new BPMObjectNameCollection();

            permisions.Add(publicPermision);

            SIDPairCollection sidPairs = new SIDPairCollection();

            for (int j = 0; j < sidCount; j++)
            {
                string sid = request.GetString("SID" + j.ToString());
                sidPairs.Add(new SIDPair(SIDType.UserSID, sid));
            }

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                for (int i = 0; i < count; i++)
                {
                    string key = request.GetString("ID" + i.ToString());

                    RecordSecurityManager.Public(cn, rsid, key, sidPairs, permisions, leadershipToken, comments, dataSource);

                    JObject processedItem = new JObject();
                    processedItem["ID"] = key;
                    processedItems.Add(processedItem);
                }

                JObject rv = new JObject();
                rv["success"]        = true;
                rv["processedItems"] = processedItems;
                return(rv);
            }
        }
コード例 #3
0
        public virtual void SaveSecurityGroup(HttpContext context)
        {
            YZRequest request   = new YZRequest(context);
            string    mode      = request.GetString("mode");
            string    groupName = request.GetString("GroupName", mode == "new", null);

            JsonSerializer serializer = new JsonSerializer();
            StreamReader   reader     = new StreamReader(context.Request.InputStream);

            using (JsonTextReader streamReader = new JsonTextReader(reader))
            {
                JArray @params = serializer.Deserialize(streamReader) as JArray;

                SecurityGroup     group = @params[0].ToObject <SecurityGroup>(serializer);
                SIDPairCollection sids  = @params[1].ToObject <SIDPairCollection>(serializer);

                using (BPMConnection cn = new BPMConnection())
                {
                    cn.WebOpen();

                    if (mode == "edit")
                    {
                        if (groupName != group.GroupName)
                        {
                            GroupManager.RenameSecurityGroup(cn, groupName, group.GroupName);
                        }

                        GroupManager.UpdateSecutiryGroup(cn, group.GroupName, sids);
                    }
                    else
                    {
                        GroupManager.AddSecutiryGroup(cn, group.GroupName, sids);
                    }
                }
            }
        }