public string DefaultRoleId(Role [] roles, Role rol_selected)
 {
     string salida = "<select name=\"DefaultRoleId\">";
     salida += "<option value=\"0\">ningun rol</option>";
     foreach (Role rol in roles)
     {
         if (rol_selected != null  && rol.Id == rol_selected.Id)
             salida += System.String.Format("<option value=\"{0}\" selected>{1}</option>", rol.Id, rol.Name);
         else
             salida += System.String.Format("<option value=\"{0}\">{1}</option>", rol.Id, rol.Name);
     }
     salida += "</select>";
     return salida;
 }
    private static string ReadRole(XmlNode node)
    {
        if (node.Name == "Role")
        {
            string code = NodeGetString(node, "nombrecorto");
            string name = NodeGetString(node, "nombrelargo");
            bool create = NodeGetBool(node, "create");
            bool modify = NodeGetBool(node, "modify");
            bool delete = NodeGetBool(node, "delete");
            bool publish = NodeGetBool(node, "publish");
            bool read = NodeGetBool(node, "read");

            System.Console.WriteLine ("Roles: "+ code);
            Role r = new Role (name, code, create, modify, delete, publish, read);
            r.Save();

            roles[code] = r;
        }
        return null;
    }
Esempio n. 3
0
 public Acl(int groupid, int roleid)
 {
     _Group = Group.Find(groupid);
     _Role = Role.Find(roleid);
 }
Esempio n. 4
0
 public Acl(string code, Group g, Role r)
 {
     _Code = code;
     _Group = g;
     _Role = r;
 }
    public string Permissions(Role r)
    {
        string salida = "";
        bool is_table = true;
        string ts = is_table ? "<td>" : "";
        string te = is_table ? "</td>" : "";

        if (r == null)
        {
            salida += ts + Checkbox("Form.CanCreate", false) + te;
            salida += ts + Checkbox("Form.CanModify", false) + te;
            salida += ts + Checkbox("Form.CanDelete", false) + te;
            salida += ts + Checkbox("Form.CanPublish", false) + te;
            salida += ts + Checkbox("Form.CanRead", false) + te;
        }
        else
        {
            salida += ts + Checkbox("Form.CanCreate", r.CanCreate) + te;
            salida += ts + Checkbox("Form.CanModify", r.CanModify) + te;
            salida += ts + Checkbox("Form.CanDelete", r.CanDelete) + te;
            salida += ts + Checkbox("Form.CanPublish", r.CanPublish) + te;
            salida += ts + Checkbox("Form.CanRead", r.CanRead) + te;
        }
        return salida;
    }
 /*public string MachinePassword(User user)
 {
 	return "<input name=\"Form.MachinePassword\" type=\"text\" value=\"" + user.MachinePassword + "\" />";
 }*/
 public string DefaultRoleId(Role [] roles)
 {
     return DefaultRoleId(roles, (Role) null);
 }
    public void RoleNew(string name)
    {
        Role role = new Role();
        role.Name = name;
        role.Save();

        Group[] groups = Group.FindAll();
        foreach (Group g in groups)
        {
            Acl acl = new Acl();
            acl.Group = g;
            acl.Role = role;
            acl.Containers = new Iesi.Collections.HashedSet(); // ArrayList();
            acl.Save();
        }

        RedirectToAction("rolesedit");
    }