Creating a new group
In this example a database is opened and a new group is created as subgroup of the main group. The new group inherits access rights from its parent (of course the main group). Finally the user "system" gets rights for write-access.
Database DemoDB = ArisanMain.EasyOpenDatabase(
"LOCAL", // server name
"de", // method name
"Demo62", // database
"system", // user
"manager", // password
"Deutsch (Deutschland)", // language
"Gesamtmethode" //config
);
// get the main group
Group Hauptgruppe = DemoDB.GetMainGroup();
// create new group and inherits access rights
// from the parent group
Group newGroup = Hauptgruppe.CreateNewSubGroup("New", true);
// get user "system"
User user_system = DemoDB.GetUser("system");
// Change access rights- for this group and
// all of its child groups.
Hauptgruppe.SetUserAccessRight(
user_system, ArisAccessRight.AR_WRITE, true);
// Close databases and Arisan
DemoDB.Close();
ArisanMain.ShutDown();
Overview for groups
After opening the database a group is accessed using an absolute path. The names of all models and object definitions are written to the console.
// Open database
[as above]
// direct access to a group
Group gAML = DemoDB.GetGroupByFullPath("/Hauptgruppe/AML");
// Show all models
IList<Model> allModels = gAML.GetModels(ArisSortOrder.Ascending);
foreach (Model model in allModels)
Console.WriteLine(model);
// Show all object definitions
IList<ObjDef> allObjDefs = gAML.GetObjDefs(ArisSortOrder.Ascending);
foreach (ObjDef def in allObjDefs)
Console.WriteLine(def);
// Close database and Arisan
DemoDB.Close();
ArisanMain.ShutDown();
Group structure
After opening the database, the main group is loaded. Starting there the names of all groups in the database are written to the console as a simple tree structure.
public static void Start()
{
// Open database
[as above]
// Load main group
Group Hauptgruppe = DemoDB.GetMainGroup();
// process groups recursively
ShowGroupRecursive(Hauptgruppe, 0);
// Close database and Arisan
DemoDB.Close();
ArisanMain.ShutDown();
}
private static void ShowGroupRecursive(Group currentGroup, int tabdepth)
{
// Show group names
Console.WriteLine("".PadLeft(tabdepth)+currentGroup.Name);
// Load subgroups and call yourself
IList<Group> SubGroups = currentGroup.GetSubgroups();
foreach (Group group in SubGroups)
ShowGroupRecursive(group, tabdepth + 2);
}

