コード例 #1
0
        //Upload the screenshot for the model
        public string GetGroupPermission(string pid, string groupname, string key)
        {
            if (!CheckKey(key))
                return null;
            pid = pid.Replace('_', ':');

            //Get the content obhect
            vwarDAL.ContentObject co = GetRepo().GetContentObjectById(pid, false);

            //Check the permissions
            if (!DoValidate(Security.TransactionType.Query, pid))
            {
                ReleaseRepo();
                return "";
            }

            vwarDAL.PermissionsManager perm = new vwarDAL.PermissionsManager();
            vwarDAL.ModelPermissionLevel level = perm.CheckGroupPermissions(perm.GetUserGroup(groupname), pid);
            perm.Dispose();
            ReleaseRepo();
            return System.Enum.GetName(typeof(vwarDAL.ModelPermissionLevel), level);
        }
コード例 #2
0
        //Upload the screenshot for the model
        public string GetUserPermission(string pid, string username, string key)
        {
            if (!CheckKey(key))
                return null;
            pid = pid.Replace('_', ':');

            //Get the content obhect
            vwarDAL.ContentObject co = GetRepo().GetContentObjectById(pid, false);

            //Check the permissions
            if (!DoValidate(Security.TransactionType.Query, pid))
            {
                ReleaseRepo();
                return "";
            }
            //tells you what hte level is for this user, taking into account group membership
            vwarDAL.ModelPermissionLevel level = vwarDAL.ModelPermissionLevel.NotSet;
            vwarDAL.PermissionsManager perm = new vwarDAL.PermissionsManager();
            foreach (vwarDAL.UserGroup g in perm.GetUsersGroups(username))
            {
                if (perm.CheckGroupPermissions(g, pid) > level)
                    level = perm.CheckGroupPermissions(g, pid);
            }
            perm.Dispose();
            ReleaseRepo();
            return System.Enum.GetName(typeof(vwarDAL.ModelPermissionLevel), level);
        }