Ejemplo n.º 1
0
        public Permission(String data, PermissionChecker checker)
        {
            var spd = StringUtils.split(data, PERMISSION_FIELDS_SEPARATOR);

            switch (spd.Count)
            {
            case 1:
                type = spd[0];
                break;

            case 2:
                entity = spd[0];
                type   = spd[1];
                break;

            default:
                throw new ArgumentException("Invalid permission: '" + data + "'");
            }

            if (checker == null)
            {
            }
            else
            {
                if (!checker.isValid(type))
                {
                    throw new ArgumentException("Invalid permission type: '" + type + "'");
                }
            }
        }