Ejemplo n.º 1
0
        public void readRole()
        {
            // Get role
            Console.WriteLine("\nEnter role:");
            String roleName = Console.ReadLine();

            if (roleName != null && roleName.Length > 0)
            {
                AdminPolicy adminPolicy = new AdminPolicy();
                Role        role        = client.QueryRole(adminPolicy, roleName);

                if (role != null)
                {
                    Console.WriteLine("\nINFO: Role read successfully! Here are the details:\n");
                    Console.WriteLine(string.Join(", ", role.privileges));
                }
                else
                {
                    Console.WriteLine("ERROR: Role not found!\n");
                }
            }
            else
            {
                Console.WriteLine("ERROR: Role not found!\n");
            }
        }
Ejemplo n.º 2
0
        public static void RefreshRoles(AerospikeClient client, User user, bool admin)
        {
            if (admin)
            {
                // Query all roles
                Roles = client.QueryRoles(null);
            }
            else
            {
                List <Role> list = new List <Role>(user.roles.Count);

                foreach (string roleName in user.roles)
                {
                    Role role = client.QueryRole(null, roleName);
                    list.Add(role);
                }
                Roles = list;
            }
        }