Yes, you can do both those things with flexible security - which will take the information out of the whois cache for it.
The basic steps to do this are
- Create a security group with the wanted access level. Or you can use one of the pre-defined ones (Admin, Super-Admin, Leader).
- Create a flexible extension for those security groups, use the GUI under !flexible for this. Whether you need an AND or OR-combined one depends on what you want to do (see below for your case).
- Add the conditions using !flexible condition add group rule
Security groups can be OR-combined, which means at least one of the conditions has to be met, or AND-combined, which means all conditions have to be met.
For your setup you need one OR-combined flexible group for the members setup. Simply create a group with members rights, create the OR-combined extension, and then add all the alliance orgs with
!flexible condition groupname org = member, where member is a member of the org you want to add (check whois to make sure the information is correct, or check !flexible GUI afterwards, it lists the org names there).
To give generals/presidents (org_rank <= 1) access as ADMIN you need to create one AND-combined extension per organisation in your alliance, as you want to make sure ADMINs are both members of an org of the alliance and have the neccessary rank. Create a security group with ADMIN access level for each organisation in your alliance, and create for those groups AND-combined extensions. Then add to each of those groups the org rank condition via
!flexible condition groupname rank_id <= 1, and add exactly one org condition to each of the ADMIN groups via
!flexible condition groupname org = member.
If you add two org conditions to the AND-combined group nobody will be able to meet the conditions, as you can only be member of one org in the whois cache. If you use an OR-combined group for ADMIN anyone with an org rank of 0 or 1 in the whois cache will meet that condition and be admin in your bot. You don't want either of those conditions.