Ejemplo n.º 1
0
        private static void IncrementCounters(ulong bits, int[] counters)
        {
            var mask = 1uL;
            var b    = bits;

            foreach (var pt in PermissionTypeBase.GetPermissionTypes())
            {
                if ((b & mask) > 0)
                {
                    counters[pt.Index]++;
                }
                mask = mask << 1;
            }
        }
Ejemplo n.º 2
0
        internal string _traceEffectivePermissionValues(int entityId, int userId, int ownerId)
        {
            var values = new char[PermissionTypeBase.PermissionCount];

            foreach (var permType in PermissionTypeBase.GetPermissionTypes())
            {
                var  val = GetPermission(userId, entityId, ownerId, permType);
                char c;
                switch (val)
                {
                case PermissionValue.Undefined: c = '_'; break;

                case PermissionValue.Allowed: c = '+'; break;

                case PermissionValue.Denied: c = '-'; break;

                default: throw new NotSupportedException("Unknown PermissionValue: " + val);
                }
                values[values.Length - permType.Index - 1] = c;
            }
            return(new string(values));
        }