/// <summary>
        ///   Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role.
        /// </summary>
        public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID,
                                int membershipFee, bool openEnrollment, bool allowPublish,
                                bool maturePublish, UUID founderID)
        {
            UUID GroupID     = UUID.Random();
            UUID OwnerRoleID = UUID.Random();

            // Would this be cleaner as (GroupPowers)ulong.MaxValue;
            GroupPowers OwnerPowers = GroupPowers.Accountable
                                      | GroupPowers.AllowEditLand
                                      | GroupPowers.AllowFly
                                      | GroupPowers.AllowLandmark
                                      | GroupPowers.AllowRez
                                      | GroupPowers.AllowSetHome
                                      | GroupPowers.AllowVoiceChat
                                      | GroupPowers.AssignMember
                                      | GroupPowers.AssignMemberLimited
                                      | GroupPowers.ChangeActions
                                      | GroupPowers.ChangeIdentity
                                      | GroupPowers.ChangeMedia
                                      | GroupPowers.ChangeOptions
                                      | GroupPowers.CreateRole
                                      | GroupPowers.DeedObject
                                      | GroupPowers.DeleteRole
                                      | GroupPowers.Eject
                                      | GroupPowers.FindPlaces
                                      | GroupPowers.Invite
                                      | GroupPowers.JoinChat
                                      | GroupPowers.LandChangeIdentity
                                      | GroupPowers.LandDeed
                                      | GroupPowers.LandDivideJoin
                                      | GroupPowers.LandEdit
                                      | GroupPowers.LandEjectAndFreeze
                                      | GroupPowers.LandGardening
                                      | GroupPowers.LandManageAllowed
                                      | GroupPowers.LandManageBanned
                                      | GroupPowers.LandManagePasses
                                      | GroupPowers.LandOptions
                                      | GroupPowers.LandRelease
                                      | GroupPowers.LandSetSale
                                      | GroupPowers.ModerateChat
                                      | GroupPowers.ObjectManipulate
                                      | GroupPowers.ObjectSetForSale
                                      | GroupPowers.ReceiveNotices
                                      | GroupPowers.RemoveMember
                                      | GroupPowers.ReturnGroupOwned
                                      | GroupPowers.ReturnGroupSet
                                      | GroupPowers.ReturnNonGroup
                                      | GroupPowers.RoleProperties
                                      | GroupPowers.SendNotices
                                      | GroupPowers.SetLandingPoint
                                      | GroupPowers.StartProposal
                                      | GroupPowers.VoteOnProposal;

            GroupsConnector.CreateGroup(GroupID, name, charter, showInList,
                                        insigniaID, 0, openEnrollment, allowPublish, maturePublish, founderID,
                                        ((ulong)m_DefaultEveryonePowers), OwnerRoleID, ((ulong)OwnerPowers));

            return(GroupID);
        }
Beispiel #2
0
        public bool HasGroupPowers(IScenePresence presence, UUID groupID, GroupPowers powers)
        {
            // If we are running without a connection to a groups service,
            // noone can be in any group
            if (m_groupsClient == null)
            {
                return(false);
            }

            // Try to fetch the group and see if this presence is a member of
            // it
            Group group;

            if (m_groupsClient.TryGetGroup(groupID, out group))
            {
                // Try to fetch membership information for this presence in the
                // group
                GroupMember member;
                if (group.Members.TryGetValue(presence.ID, out member))
                {
                    GroupPowers aggregatePowers = GroupPowers.None;

                    for (int i = 0; i < member.Roles.Count; i++)
                    {
                        GroupPowers rolePowers = (GroupPowers)member.Roles[i].Attributes["powers"].AsInteger();
                        aggregatePowers |= rolePowers;
                    }

                    return((aggregatePowers & powers) == powers);
                }
            }

            return(false);
        }
Beispiel #3
0
 public GroupRolemember(GroupRolemember src)
 {
     Group     = new UGI(src.Group);
     RoleID    = src.RoleID;
     Principal = new UGUI(src.Principal);
     Powers    = src.Powers;
 }
Beispiel #4
0
        private bool HasGroupPower(GroupPowers power, UUID groupID)
        {
            if (!instance.State.Groups.ContainsKey(groupID))
            {
                return(false);
            }

            return((instance.State.Groups[groupID].Powers & power) != 0);
        }
Beispiel #5
0
 public GroupRole(GroupRole src)
 {
     Group       = new UGI(src.Group);
     ID          = src.ID;
     Name        = src.Name;
     Description = src.Description;
     Title       = src.Title;
     Powers      = src.Powers;
     Members     = src.Members;
 }
        private bool GroupPermissionCheck(UUID AgentID, UUID GroupID, GroupPowers groupPowers)
        {
            GroupMembershipData GMD = m_groupData.GetGroupMembershipData(AgentID, GroupID, AgentID);

            if (GMD == null)
            {
                return(false);
            }
            return((GMD.GroupPowers & (ulong)groupPowers) == (ulong)groupPowers);
        }
        public virtual GroupInfo CreateGroup(UGUI requestingAgent, GroupInfo ginfo, GroupPowers everyonePowers, GroupPowers ownerPowers)
        {
            var role_everyone = new GroupRole
            {
                ID          = UUID.Zero,
                Group       = ginfo.ID,
                Name        = "Everyone",
                Description = "Everyone in the group",
                Title       = "Member of " + ginfo.ID.GroupName,
                Powers      = everyonePowers
            };
            var role_owner = new GroupRole
            {
                ID          = UUID.Random,
                Group       = ginfo.ID,
                Name        = "Owners",
                Description = "Owners of the group",
                Title       = "Owner of " + ginfo.ID.GroupName,
                Powers      = ownerPowers
            };

            ginfo.OwnerRoleID = role_owner.ID;

            var gmemrole_owner = new GroupRolemember
            {
                Group     = ginfo.ID,
                RoleID    = role_owner.ID,
                Principal = ginfo.Founder
            };
            var gmemrole_everyone = new GroupRolemember
            {
                Group     = ginfo.ID,
                RoleID    = role_everyone.ID,
                Principal = ginfo.Founder
            };

            Groups.Create(requestingAgent, ginfo);

            try
            {
                Roles.Add(requestingAgent, role_everyone);
                Roles.Add(requestingAgent, role_owner);
                Members.Add(requestingAgent, ginfo.ID, ginfo.Founder, role_owner.ID, UUID.Random.ToString());
                Rolemembers.Add(requestingAgent, gmemrole_owner);
                Rolemembers.Add(requestingAgent, gmemrole_everyone);
                ginfo.RoleCount   = 2;
                ginfo.MemberCount = 1;
            }
            catch
            {
                Groups.Delete(requestingAgent, ginfo.ID);
                throw;
            }
            return(ginfo);
        }
        public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers groupPowers)
        {
            EditParcelPropertiesHandler handler = OnEditParcelProperties;

            if (handler != null)
            {
                Delegate[] list = handler.GetInvocationList();
                return(list.Cast <EditParcelPropertiesHandler>().All(h => h(user, parcel, groupPowers, m_scene) != false));
            }
            return(true);
        }
Beispiel #9
0
        bool GroupPermissionCheck(UUID agentID, UUID groupID, GroupPowers groupPowers)
        {
            GroupMembershipData grpMD = m_groupData.GetGroupMembershipData(agentID, groupID, agentID);

            if (grpMD == null)
            {
                return(false);
            }

            return((grpMD.GroupPowers & (ulong)groupPowers) == (ulong)groupPowers);
        }
Beispiel #10
0
        public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p)
        {
            EditParcelPropertiesHandler handler = OnEditParcelProperties;

            if (handler != null)
            {
                Delegate[] list = handler.GetInvocationList();
                foreach (EditParcelPropertiesHandler h in list)
                {
                    if (h(user, parcel, p, m_scene) == false)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
        private bool HasPower(string agentID, UUID groupID, GroupPowers power)
        {
            RoleMembershipData[] rmembership = m_Database.RetrieveMemberRoles(groupID, agentID);
            if (rmembership == null || (rmembership != null && rmembership.Length == 0))
            {
                return(false);
            }

            foreach (RoleMembershipData rdata in rmembership)
            {
                RoleData role = m_Database.RetrieveRole(groupID, rdata.RoleID);
                if ((UInt64.Parse(role.Data["Powers"]) & (ulong)power) != 0)
                {
                    return(true);
                }
            }
            return(false);
        }
 public GroupMembership(GroupInfo info, GroupMember mem, GroupRole role, UUID activeRoleID)
 {
     Group            = info.ID;
     Principal        = mem.Principal;
     GroupPowers      = role.Powers;
     IsAcceptNotices  = mem.IsAcceptNotices;
     GroupInsigniaID  = info.InsigniaID;
     Contribution     = mem.Contribution;
     GroupTitle       = role.Title;
     IsListInProfile  = mem.IsListInProfile;
     IsAllowPublish   = info.IsAllowPublish;
     Charter          = info.Charter;
     ActiveRoleID     = activeRoleID;
     Founder          = info.Founder;
     AccessToken      = mem.AccessToken;
     IsMaturePublish  = info.IsMaturePublish;
     IsOpenEnrollment = info.IsOpenEnrollment;
     MembershipFee    = info.MembershipFee;
     IsShownInList    = info.IsShownInList;
 }
Beispiel #13
0
        /// <summary>
        /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role.
        /// </summary>
        public UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID,
                                int membershipFee, bool openEnrollment, bool allowPublish,
                                bool maturePublish, UUID founderID)
        {
            UUID GroupID     = UUID.Random();
            UUID OwnerRoleID = UUID.Random();

            Hashtable param = new Hashtable();

            param["GroupID"]        = GroupID.ToString();
            param["Name"]           = name;
            param["Charter"]        = charter;
            param["ShowInList"]     = showInList == true ? 1 : 0;
            param["InsigniaID"]     = insigniaID.ToString();
            param["MembershipFee"]  = 0;
            param["OpenEnrollment"] = openEnrollment == true ? 1 : 0;
            param["AllowPublish"]   = allowPublish == true ? 1 : 0;
            param["MaturePublish"]  = maturePublish == true ? 1 : 0;
            param["FounderID"]      = founderID.ToString();
            param["EveryonePowers"] = ((ulong)Constants.DefaultEveryonePowers).ToString();
            param["OwnerRoleID"]    = OwnerRoleID.ToString();

            // Would this be cleaner as (GroupPowers)ulong.MaxValue;
            GroupPowers OwnerPowers = (GroupPowers)ulong.MaxValue;

            param["OwnersPowers"] = ((ulong)OwnerPowers).ToString();



            Hashtable respData = XmlRpcCall(requestID, "groups.createGroup", param);

            if (respData.Contains("error"))
            {
                // UUID is not nullable

                return(UUID.Zero);
            }

            return(UUID.Parse((string)respData["GroupID"]));
        }
Beispiel #14
0
        public bool HasGroupPowers(IScenePresence presence, UUID groupID, GroupPowers powers)
        {
            // If we are running without a connection to a groups service,
            // noone can be in any group
            if (m_groupsClient == null)
                return false;

            // Try to fetch the group and see if this presence is a member of
            // it
            Group group;
            if (m_groupsClient.TryGetGroup(groupID, out group))
            {
                // Try to fetch membership information for this presence in the
                // group
                GroupMember member;
                if (group.Members.TryGetValue(presence.ID, out member))
                {
                    GroupPowers aggregatePowers = GroupPowers.None;

                    for (int i = 0; i < member.Roles.Count; i++)
                    {
                        GroupPowers rolePowers = (GroupPowers)member.Roles[i].Attributes["powers"].AsInteger();
                        aggregatePowers |= rolePowers;
                    }

                    return (aggregatePowers & powers) == powers;
                }
            }

            return false;
        }
 public static GroupRolemembership ToGroupRolemembershipEveryone(this MySqlDataReader reader, GroupPowers powers) => new GroupRolemembership()
 {
     Group     = new UGI(reader.GetUUID("GroupID")),
     RoleID    = UUID.Zero,
     Principal = new UUI(reader.GetUUID("PrincipalID")),
     Powers    = powers
 };
Beispiel #16
0
        private void AgentDataUpdateHandler(Packet packet, Simulator simulator)
        {
            AgentDataUpdatePacket p = (AgentDataUpdatePacket)packet;

            if (p.AgentData.AgentID == simulator.Client.Self.AgentID)
            {
                firstName = Utils.BytesToString(p.AgentData.FirstName);
                lastName = Utils.BytesToString(p.AgentData.LastName);
                activeGroup = p.AgentData.ActiveGroupID;
                activeGroupPowers = (GroupPowers)p.AgentData.GroupPowers;

                if (OnAgentDataUpdated != null)
                {
                    string groupTitle = Utils.BytesToString(p.AgentData.GroupTitle);
                    string groupName = Utils.BytesToString(p.AgentData.GroupName);

                    try { OnAgentDataUpdated(firstName, lastName, activeGroup, groupTitle, (GroupPowers)p.AgentData.GroupPowers, groupName); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
            else
            {
                Logger.Log("Got an AgentDataUpdate packet for avatar " + p.AgentData.AgentID.ToString() +
                    " instead of " + Client.Self.AgentID.ToString() + ", this shouldn't happen", Helpers.LogLevel.Error, Client);
            }
        }
Beispiel #17
0
 private osgRole AddRole2Group(osGroup group, string name, string description, string title, GroupPowers powers)
 {
     return(AddRole2Group(group, name, description, title, powers, UUID.Random()));
 }
 public GroupInsufficientPowersException(GroupPowers power)
     : base(string.Format("Missing group permission {0}", power.ToString()))
 {
 }
 private bool GroupPermissionCheck(UUID AgentID, UUID GroupID, GroupPowers groupPowers)
 {
     GroupMembershipData GMD = m_groupData.GetGroupMembershipData(AgentID, GroupID, AgentID);
     if (GMD == null) return false;
     return (GMD.GroupPowers & (ulong) groupPowers) == (ulong) groupPowers;
 }
 public void VerifyAgentPowers(UGI group, UGUI agent, GroupPowers powers)
 {
     VerifyAgentPowers(group, agent, new GroupPowers[] { powers });
 }
        /// <summary>
        ///     WARNING: This is not the only place permissions are checked! They are checked in each of the connectors as well!
        /// </summary>
        /// <param name="AgentID"></param>
        /// <param name="GroupID"></param>
        /// <param name="permissions"></param>
        /// <returns></returns>
        public bool GroupPermissionCheck(UUID AgentID, UUID GroupID, GroupPowers permissions)
        {
            if (GroupID == UUID.Zero)
                return false;

            if (AgentID == UUID.Zero)
                return false;

            ulong ourPowers = 0;

            Dictionary<UUID, ulong> groupsCache;
            lock (AgentGroupPowersCache)
            {
                if (AgentGroupPowersCache.TryGetValue(AgentID, out groupsCache))
                {
                    if (groupsCache.ContainsKey(GroupID))
                    {
                        ourPowers = groupsCache[GroupID];
                        if (ourPowers == 1)
                            return false;
                        //1 means not in the group or not found in the cache, so stop it here so that we don't check every time, and it can't be a permission, as its 0 then 2 in GroupPermissions
                    }
                }
            }
            //Ask the server as we don't know about this user
            if (ourPowers == 0)
            {
                GroupMembershipData GMD = AttemptFindGroupMembershipData(AgentID, AgentID, GroupID);
                if (GMD == null)
                {
                    AddToGroupPowersCache(AgentID, GroupID, 1);
                    return false;
                }
                ourPowers = GMD.GroupPowers;
                //Add to the cache
                AddToGroupPowersCache(AgentID, GroupID, ourPowers);
            }

            //The user is the group, or it would have been weeded out earlier, so check whether we just need to know whether they are in the group
            if (permissions == GroupPowers.None)
                return true;

            if ((((GroupPowers) ourPowers) & permissions) != permissions)
                return false;

            return true;
        }
        void showpowers(Gtk.TreeStore store,GroupPowers powers)
        {
            Gtk.TreeIter iterx;
                    bool test;
                    iterx = store.AppendValues(folder_open, "Membership Managment", GroupPowers.None);
                    test=(powers & GroupPowers.Invite) == GroupPowers.Invite;
                    store.AppendValues(iterx,test?tick:cross,"Invite people to group",GroupPowers.Invite);
                    test=(powers & GroupPowers.Eject) == GroupPowers.Eject;
                    store.AppendValues(iterx,test?tick:cross,"Eject members",GroupPowers.Eject);
                    test=(powers & GroupPowers.ChangeOptions) == GroupPowers.ChangeOptions; //?????????
                    store.AppendValues(iterx,test?tick:cross,"Toggle Open Enrollment",GroupPowers.ChangeOptions);

                    iterx = store.AppendValues(folder_open, "Roles", GroupPowers.None);
                    test=(powers & GroupPowers.CreateRole) == GroupPowers.CreateRole; //?????????
                    store.AppendValues(iterx,test?tick:cross,"Toggle Open Enrollment",GroupPowers.CreateRole);
                    test=(powers & GroupPowers.DeleteRole) == GroupPowers.DeleteRole; //?????????
                    store.AppendValues(iterx,test?tick:cross,"Delete ROles",GroupPowers.DeleteRole);
                    test=(powers & GroupPowers.RoleProperties) == GroupPowers.RoleProperties; //?????????
                    store.AppendValues(iterx,test?tick:cross,"Change ROle names,titles",GroupPowers.RoleProperties);
                    test=(powers & GroupPowers.AssignMemberLimited) == GroupPowers.AssignMemberLimited; //?????????
                    store.AppendValues(iterx,test?tick:cross,"Assign Members to Assigners Role",GroupPowers.AssignMemberLimited);
                    test=(powers & GroupPowers.AssignMember) == GroupPowers.AssignMember; //?????????
                    store.AppendValues(iterx,test?tick:cross,"Assign Members to Any Role",GroupPowers.AssignMember);
                    test=(powers & GroupPowers.RemoveMember) == GroupPowers.RemoveMember; //?????????
                    store.AppendValues(iterx,test?tick:cross,"Remove Members from Roles",GroupPowers.RemoveMember);
                    test=(powers & GroupPowers.ChangeIdentity) == GroupPowers.ChangeIdentity; //?????????
                    store.AppendValues(iterx,test?tick:cross,"Assign and Remove Abilities",GroupPowers.ChangeIdentity);

                    iterx = store.AppendValues(folder_open, "Parcel Managment", GroupPowers.None);
                    test=(powers & GroupPowers.LandDeed) == GroupPowers.LandDeed; //?????????
                    store.AppendValues(iterx,test?tick:cross,"Deed land and buy land for group",GroupPowers.LandDeed);
                    test=(powers & GroupPowers.LandRelease) == GroupPowers.LandRelease; //?????????
                    store.AppendValues(iterx,test?tick:cross,"Abandon land",GroupPowers.LandRelease);
                    test=(powers & GroupPowers.LandSetSale) == GroupPowers.LandSetSale; //?????????
                    store.AppendValues(iterx,test?tick:cross,"Set land for sale info",GroupPowers.LandSetSale);
                    test=(powers & GroupPowers.LandDivideJoin) == GroupPowers.LandDivideJoin;
                    store.AppendValues(iterx,test?tick:cross,"Join and Divide Parcels",GroupPowers.LandDivideJoin);

                    iterx = store.AppendValues(folder_open, "Parcel Identy", GroupPowers.None);
                    test=(powers & GroupPowers.FindPlaces) == GroupPowers.FindPlaces;
                    store.AppendValues(iterx,test?tick:cross,"Toggle show in Find Places",GroupPowers.FindPlaces);
                    test=(powers & GroupPowers.LandChangeIdentity) == GroupPowers.LandChangeIdentity;
                    store.AppendValues(iterx,test?tick:cross,"Change parcel name and Description",GroupPowers.LandChangeIdentity);
                    test=(powers & GroupPowers.SetLandingPoint) == GroupPowers.SetLandingPoint;
                    store.AppendValues(iterx,test?tick:cross,"Set Landing point",GroupPowers.SetLandingPoint);

                    iterx = store.AppendValues(folder_open, "Parcel Settings", GroupPowers.None);
                    test=(powers & GroupPowers.ChangeMedia) == GroupPowers.ChangeMedia;
                    store.AppendValues(iterx,test?tick:cross,"Change music & media settings",GroupPowers.ChangeMedia);
                    test=(powers & GroupPowers.ChangeOptions) == GroupPowers.ChangeOptions;
                    store.AppendValues(iterx,test?tick:cross,"Toggle various about->land options",GroupPowers.ChangeOptions);

                    iterx = store.AppendValues(folder_open, "Parcel Powers", GroupPowers.None);
                    test=(powers & GroupPowers.AllowEditLand) == GroupPowers.AllowEditLand;
                    store.AppendValues(iterx,test?tick:cross,"Always allow Edit Terrain",GroupPowers.AllowEditLand);
                    test=(powers & GroupPowers.AllowFly) == GroupPowers.AllowFly;
                    store.AppendValues(iterx,test?tick:cross,"Always allow fly",GroupPowers.AllowFly);
                    test=(powers & GroupPowers.AllowRez) == GroupPowers.AllowRez;
                    store.AppendValues(iterx,test?tick:cross,"Always allow Create Objects",GroupPowers.AllowRez);
                    test=(powers & GroupPowers.AllowLandmark) == GroupPowers.AllowLandmark;
                    store.AppendValues(iterx, test?tick:cross, "Always allow Create Landmarks", GroupPowers.AllowLandmark);
                    test=(powers & GroupPowers.AllowSetHome) == GroupPowers.AllowSetHome;
                    store.AppendValues(iterx,test?tick:cross,"Allow Set Home to Hete on group land",GroupPowers.AllowSetHome);

                    iterx = store.AppendValues(folder_open, "Parcel Access", GroupPowers.None);
                    test=(powers & GroupPowers.LandManageAllowed) == GroupPowers.LandManageAllowed;
                    store.AppendValues(iterx,test?tick:cross,"Manage parcel Access lists",GroupPowers.LandManageAllowed);
                    test=(powers & GroupPowers.LandManageBanned) == GroupPowers.LandManageBanned;
                    store.AppendValues(iterx,test?tick:cross,"Manage Ban lists",GroupPowers.LandManageBanned);
                    test=(powers & GroupPowers.LandEjectAndFreeze) == GroupPowers.LandEjectAndFreeze;
                    store.AppendValues(iterx,test?tick:cross,"Eject and freeze Residents on parcel",GroupPowers.LandEjectAndFreeze);

                    iterx = store.AppendValues(folder_open, "Parcel Content", GroupPowers.None);
                    test=(powers & GroupPowers.ReturnGroupOwned) == GroupPowers.ReturnGroupOwned;
                    store.AppendValues(iterx,test?tick:cross,"Return objects owner by group",GroupPowers.ReturnGroupSet);
                    test=(powers & GroupPowers.ReturnGroupSet) == GroupPowers.ReturnGroupSet;
                    store.AppendValues(iterx,test?tick:cross,"Return objects set to group",GroupPowers.ReturnGroupSet);
                    test=(powers & GroupPowers.ReturnNonGroup) == GroupPowers.ReturnNonGroup;
                    store.AppendValues(iterx,test?tick:cross,"Return non-group objects",GroupPowers.ReturnNonGroup);
                    test=(powers & GroupPowers.LandGardening) == GroupPowers.LandGardening;
                    store.AppendValues(iterx,test?tick:cross,"Landscaping using Linden Plants",GroupPowers.LandGardening);

                    iterx = store.AppendValues(folder_open, "Object Managment", GroupPowers.None);
                    test=(powers & GroupPowers.DeedObject) == GroupPowers.DeedObject;
                    store.AppendValues(iterx,test?tick:cross,"Deed objects to group",GroupPowers.DeedObject);
                    test=(powers & GroupPowers.ObjectManipulate) == GroupPowers.ObjectManipulate;
                    store.AppendValues(iterx,test?tick:cross,"Manipulate (move,copy,modify) group objetcs",GroupPowers.ObjectManipulate);
                    test=(powers & GroupPowers.ObjectSetForSale) == GroupPowers.ObjectSetForSale;
                    store.AppendValues(iterx,test?tick:cross,"Set group objects for sale",GroupPowers.ObjectSetForSale);

                    iterx = store.AppendValues(folder_open, "Notices", GroupPowers.None);
                    test=(powers & GroupPowers.SendNotices) == GroupPowers.SendNotices;
                    store.AppendValues(iterx,test?tick:cross,"Send Notices",GroupPowers.SendNotices);
                    test=(powers & GroupPowers.ReceiveNotices) == GroupPowers.ReceiveNotices;
                    store.AppendValues(iterx,test?tick:cross,"Receive Notices and view past Notices",GroupPowers.ReceiveNotices);

                    iterx = store.AppendValues(folder_open, "Proposals", GroupPowers.None);
                    test=(powers & GroupPowers.StartProposal) == GroupPowers.StartProposal;
                    store.AppendValues(iterx,test?tick:cross,"Create Proposals",GroupPowers.StartProposal);
                    test=(powers & GroupPowers.VoteOnProposal) == GroupPowers.VoteOnProposal;
                    store.AppendValues(iterx,test?tick:cross,"Vote on Proposals",GroupPowers.VoteOnProposal);

                    iterx = store.AppendValues(folder_open, "Chat", GroupPowers.None);
                    test=(powers & GroupPowers.JoinChat) == GroupPowers.JoinChat;
                    store.AppendValues(iterx,test?tick:cross,"Join Group Chat",GroupPowers.JoinChat);
                    test=(powers & GroupPowers.AllowVoiceChat) == GroupPowers.AllowVoiceChat;
                    store.AppendValues(iterx,test?tick:cross,"Join Group Voice Chat",GroupPowers.AllowVoiceChat);

                this.treeview_allowed_ability1.ExpandAll();
        }
        public GroupInfo(UUID groupID,bool mine)
            : base(Gtk.WindowType.Toplevel)
        {
            this.Build();

            groupkey=groupID;
            already_member=mine;

            this.label_name.Text = " Waiting ....";
            this.label_foundedby.Text = "Waiting ...";

            store_members = new Gtk.ListStore (typeof(string),typeof(string),typeof(string),typeof(UUID));
            treeview_members.AppendColumn("Member name",new CellRendererText(),"text",0);
            treeview_members.AppendColumn("Title",new CellRendererText(),"text",1);
            treeview_members.AppendColumn("Last login",new CellRendererText(),"text",2);
            treeview_members.Model=store_members;

            //Tree view for Members & Roles, Members

            this.store_membersandroles_members=new Gtk.ListStore(typeof(string),typeof(string),typeof(string),typeof(UUID));
            this.treeview_members1.AppendColumn("Member name",new CellRendererText(),"text",0);
            this.treeview_members1.AppendColumn("Land",new CellRendererText(),"text",1);
            this.treeview_members1.AppendColumn("Title",new CellRendererText(),"text",2);
            this.treeview_members1.Model=store_membersandroles_members;

            //Tree view for Roles
            assigned_roles = new Gtk.ListStore (typeof(bool),typeof(string),typeof(GroupPowers));
            this.treeview_assigned_roles.AppendColumn("",new Gtk.CellRendererToggle(),"active",0);
            this.treeview_assigned_roles.AppendColumn("Role",new CellRendererText(),"text",1);
            this.treeview_assigned_roles.Model=assigned_roles;

            //Tree view for group notices
            notice_list = new Gtk.ListStore(typeof(string), typeof(string), typeof(UUID),typeof(OpenMetaverse.GroupNoticesListEntry));
            this.treeview_notice_list.AppendColumn("From", new CellRendererText(), "text", 0);
            this.treeview_notice_list.AppendColumn("Subject", new CellRendererText(), "text", 1);
            this.treeview_notice_list.Model = notice_list;

            store_membersandroles_powers = new Gtk.TreeStore(typeof(Gdk.Pixbuf), typeof(string), typeof(GroupPowers));
            this.treeview_allowed_ability1.AppendColumn("",new CellRendererPixbuf(),"pixbuf",0);
            this.treeview_allowed_ability1.AppendColumn("Role", new CellRendererText(), "text", 1);
            this.treeview_allowed_ability1.Model = store_membersandroles_powers;

            this.store_roles_list = new Gtk.TreeStore(typeof(string),typeof(string),typeof(string),typeof(UUID));
            this.treeview_roles_list.AppendColumn("Role Name",new CellRendererText(), "text", 0);
            this.treeview_roles_list.AppendColumn("Title",new CellRendererText(), "text", 1);
            this.treeview_roles_list.AppendColumn("Members",new CellRendererText(), "text", 2);
            this.treeview_roles_list.Model=this.store_roles_list;

            this.store_roles_abilities = new Gtk.TreeStore(typeof(Gdk.Pixbuf), typeof(string), typeof(UUID));
            this.treeview_roles_abilities.AppendColumn("",new CellRendererPixbuf(),"pixbuf",0);
            //this.treeview_allowed_ability1.AppendColumn("", new Gtk.CellRendererToggle(), "active", 0);
            this.treeview_roles_abilities.AppendColumn("Allowed Abilities", new CellRendererText(), "text", 1);
            this.treeview_roles_abilities.Model = this.store_roles_abilities;

            this.store_roles_members = new Gtk.TreeStore(typeof(string));
            treeview_roles_assigned_members.AppendColumn("Assigned Members", new CellRendererText(), "text", 0);
            treeview_roles_assigned_members.Model=this.store_roles_members;

            this.store_abilities=new Gtk.TreeStore(typeof(Gdk.Pixbuf), typeof(string), typeof(GroupPowers));
            this.treeview_abilities.AppendColumn("",new CellRendererPixbuf(),"pixbuf",0);
            this.treeview_abilities.AppendColumn("Abilities", new CellRendererText(), "text", 1);
            this.treeview_abilities.Model=this.store_abilities;

            this.store_members_with_ability=new Gtk.TreeStore(typeof(string));
            this.treeview_members_with_ability.AppendColumn("Members with ability",new CellRendererText(), "text", 0);
            this.treeview_members_with_ability.Model=this.store_members_with_ability;

            this.store_roles_with_ability=new Gtk.TreeStore(typeof(string));
            this.treeview_roles_with_ability.AppendColumn("Roles with ability",new CellRendererText(), "text", 0);
            this.treeview_roles_with_ability.Model=this.store_roles_with_ability;

            GroupPowers powers=new GroupPowers();
            powers = (GroupPowers)0xffffffff;
            this.showpowers(this.store_abilities,powers);
            this.treeview_abilities.ExpandAll();

            this.store_groupland=new Gtk.TreeStore(typeof(string),typeof(string),typeof(string));
            this.treeview_groupland.AppendColumn("Parcel name",new CellRendererText(), "text", 0);
            this.treeview_groupland.AppendColumn("Region",new CellRendererText(), "text", 1);
            this.treeview_groupland.AppendColumn("Area",new CellRendererText(), "text", 2);

            MainClass.client.Groups.GroupProfile += new EventHandler<GroupProfileEventArgs>(Groups_GroupProfile);
            MainClass.client.Groups.GroupMembersReply += new EventHandler<GroupMembersReplyEventArgs>(Groups_GroupMembersReply);
            MainClass.client.Groups.GroupTitlesReply += new EventHandler<GroupTitlesReplyEventArgs>(Groups_GroupTitlesReply);
            MainClass.client.Groups.GroupRoleDataReply += new EventHandler<GroupRolesDataReplyEventArgs>(Groups_GroupRoleDataReply);
            MainClass.client.Groups.GroupRoleMembersReply += new EventHandler<GroupRolesMembersReplyEventArgs>(Groups_GroupRoleMembersReply);
            MainClass.client.Groups.GroupNoticesListReply += new EventHandler<GroupNoticesListReplyEventArgs>(Groups_GroupNoticesListReply);
            MainClass.client.Groups.GroupAccountSummaryReply += new EventHandler<GroupAccountSummaryReplyEventArgs>(Groups_GroupAccountSummaryReply);
            MainClass.client.Self.IM += new EventHandler<InstantMessageEventArgs>(Self_IM);

            MainClass.client.Groups.RequestGroupProfile(groupID);

            rcvd_names.Clear();

            name_poll = true;
            GLib.Timeout.Add(500, updategroupmembers);
            request_members = MainClass.client.Groups.RequestGroupMembers(groupID);

            if(mine)
            {
                request_titles = MainClass.client.Groups.RequestGroupTitles(groupID);
                request_roles = MainClass.client.Groups.RequestGroupRoles(groupID);  //this is indexed by group ID
                request_roles_members = MainClass.client.Groups.RequestGroupRolesMembers(groupID);

                request_roles = groupID; //CORRECT
                request_roles_members = groupID;
                request_titles = groupID;
                //request_members = group.ID;

                MainClass.client.Groups.RequestGroupNoticesList(groupID);
               // MainClass.client.Groups.RequestGroupAccountSummary(groupID,7,1);
            }
            else
            {
                Gtk.Widget widg=this.notebook1.GetNthPage(1);
                widg.Visible=false;
                widg=this.notebook1.GetNthPage(2);
                widg.Visible=false;
                widg=this.notebook1.GetNthPage(3);
                widg.Visible=false;
                widg=this.notebook1.GetNthPage(4);
                widg.Visible=false;
            }

            this.button_join.Sensitive=false;
            this.button_invite.Sensitive=false;

            this.DeleteEvent += new DeleteEventHandler(OnDeleteEvent);

            this.notebook1.Page=0;
            this.notebook2.Page=0;
            this.label_char_count.Text="";
        }
Beispiel #24
0
        private osgRole AddRole2Group(osGroup group, string name, string description, string title, GroupPowers powers, UUID roleid)
        {
            osgRole newRole = new osgRole();

            // everyoneRole.RoleID = UUID.Random();
            newRole.RoleID      = roleid;
            newRole.Name        = name;
            newRole.Description = description;
            newRole.Powers      = (GroupPowers)powers & group.PowersMask;
            newRole.Title       = title;
            newRole.Group       = group;

            group.Roles.Add(newRole.RoleID, newRole);

            return(newRole);
        }
        private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene)
        {
            DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
            if (m_bypassPermissions) return m_bypassPermissionsValue;

            return GenericParcelOwnerPermission(user, parcel, (ulong)p);
        }
 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p)
 {
     EditParcelPropertiesHandler handler = OnEditParcelProperties;
     if (handler != null)
     {
         Delegate[] list = handler.GetInvocationList();
         foreach (EditParcelPropertiesHandler h in list)
         {
             if (h(user, parcel, p, m_scene) == false)
                 return false;
         }
     }
     return true;
 }
Beispiel #27
0
        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void AgentDataUpdateHandler(object sender, PacketReceivedEventArgs e)
        {
            Packet packet = e.Packet;
            Simulator simulator = e.Simulator;

            AgentDataUpdatePacket p = (AgentDataUpdatePacket)packet;

            if (p.AgentData.AgentID == simulator.Client.Self.AgentID)
            {
                firstName = Utils.BytesToString(p.AgentData.FirstName);
                lastName = Utils.BytesToString(p.AgentData.LastName);
                activeGroup = p.AgentData.ActiveGroupID;
                activeGroupPowers = (GroupPowers)p.AgentData.GroupPowers;

                if (m_AgentData != null)
                {
                    string groupTitle = Utils.BytesToString(p.AgentData.GroupTitle);
                    string groupName = Utils.BytesToString(p.AgentData.GroupName);

                    OnAgentData(new AgentDataReplyEventArgs(firstName, lastName, activeGroup, groupTitle, activeGroupPowers, groupName));
                }
            }
            else
            {
                Logger.Log("Got an AgentDataUpdate packet for avatar " + p.AgentData.AgentID.ToString() +
                    " instead of " + Client.Self.AgentID.ToString() + ", this shouldn't happen", Helpers.LogLevel.Error, Client);
            }
        }
        /// <summary>
        ///   Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role.
        /// </summary>
        public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID,
                                int membershipFee, bool openEnrollment, bool allowPublish,
                                bool maturePublish, UUID founderID)
        {
            UUID GroupID     = UUID.Random();
            UUID OwnerRoleID = UUID.Random();

            Hashtable param = new Hashtable();

            param["GroupID"]        = GroupID.ToString();
            param["Name"]           = name;
            param["Charter"]        = charter;
            param["ShowInList"]     = showInList ? 1 : 0;
            param["InsigniaID"]     = insigniaID.ToString();
            param["MembershipFee"]  = 0;
            param["OpenEnrollment"] = openEnrollment ? 1 : 0;
            param["AllowPublish"]   = allowPublish ? 1 : 0;
            param["MaturePublish"]  = maturePublish ? 1 : 0;
            param["FounderID"]      = founderID.ToString();
            param["EveryonePowers"] = ((ulong)m_DefaultEveryonePowers).ToString();
            param["OwnerRoleID"]    = OwnerRoleID.ToString();

            // Would this be cleaner as (GroupPowers)ulong.MaxValue;
            GroupPowers OwnerPowers = GroupPowers.Accountable
                                      | GroupPowers.AllowEditLand
                                      | GroupPowers.AllowFly
                                      | GroupPowers.AllowLandmark
                                      | GroupPowers.AllowRez
                                      | GroupPowers.AllowSetHome
                                      | GroupPowers.AllowVoiceChat
                                      | GroupPowers.AssignMember
                                      | GroupPowers.AssignMemberLimited
                                      | GroupPowers.ChangeActions
                                      | GroupPowers.ChangeIdentity
                                      | GroupPowers.ChangeMedia
                                      | GroupPowers.ChangeOptions
                                      | GroupPowers.CreateRole
                                      | GroupPowers.DeedObject
                                      | GroupPowers.DeleteRole
                                      | GroupPowers.Eject
                                      | GroupPowers.FindPlaces
                                      | GroupPowers.Invite
                                      | GroupPowers.JoinChat
                                      | GroupPowers.LandChangeIdentity
                                      | GroupPowers.LandDeed
                                      | GroupPowers.LandDivideJoin
                                      | GroupPowers.LandEdit
                                      | GroupPowers.LandEjectAndFreeze
                                      | GroupPowers.LandGardening
                                      | GroupPowers.LandManageAllowed
                                      | GroupPowers.LandManageBanned
                                      | GroupPowers.LandManagePasses
                                      | GroupPowers.LandOptions
                                      | GroupPowers.LandRelease
                                      | GroupPowers.LandSetSale
                                      | GroupPowers.ModerateChat
                                      | GroupPowers.ObjectManipulate
                                      | GroupPowers.ObjectSetForSale
                                      | GroupPowers.ReceiveNotices
                                      | GroupPowers.RemoveMember
                                      | GroupPowers.ReturnGroupOwned
                                      | GroupPowers.ReturnGroupSet
                                      | GroupPowers.ReturnNonGroup
                                      | GroupPowers.RoleProperties
                                      | GroupPowers.SendNotices
                                      | GroupPowers.SetLandingPoint
                                      | GroupPowers.StartProposal
                                      | GroupPowers.VoteOnProposal;

            param["OwnersPowers"] = ((ulong)OwnerPowers).ToString();


            Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param);

            if (respData.Contains("error"))
            {
                // UUID is not nullable

                return(UUID.Zero);
            }

            return(UUID.Parse((string)respData["GroupID"]));
        }
Beispiel #29
0
 public static GroupRolemember ToGroupRolememberEveryone(this NpgsqlDataReader reader, GroupPowers powers) => new GroupRolemember
 {
     Group     = new UGI(reader.GetUUID("GroupID")),
     RoleID    = UUID.Zero,
     Principal = reader.GetUGUI("PrincipalID"),
     Powers    = powers
 };
Beispiel #30
0
        /// <summary>
        /// WARNING: This is not the only place permissions are checked! They are checked in each of the connectors as well!
        /// </summary>
        /// <param name="AgentID"></param>
        /// <param name="GroupID"></param>
        /// <returns></returns>
        public bool GroupPermissionCheck(UUID AgentID, UUID GroupID, GroupPowers permissions)
        {
            if (GroupID == UUID.Zero)
                return false;

            if (AgentID == UUID.Zero)
                return false;

            GroupMembershipData GMD = m_groupData.GetAgentGroupMembership(AgentID, GroupID, AgentID);
            if (GMD == null)
                return false;
            else if (permissions == GroupPowers.None)
                return true;

            if ((((GroupPowers)GMD.GroupPowers) & permissions) != permissions)
                return false;

            return true;
        }
 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene, bool allowManager)
 {
     return m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g, allowManager);
 }
Beispiel #32
0
        private bool HasPower(string agentID, UUID groupID, GroupPowers power)
        {
            RoleMembershipData[] rmembership = m_Database.RetrieveMemberRoles(groupID, agentID);
            if (rmembership == null || (rmembership != null && rmembership.Length == 0))
                return false;

            foreach (RoleMembershipData rdata in rmembership)
            {
                RoleData role = m_Database.RetrieveRole(groupID, rdata.RoleID);
                if ( (UInt64.Parse(role.Data["Powers"]) & (ulong)power) != 0 )
                    return true;
            }
            return false;
        }
Beispiel #33
0
 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers groupPowers)
 {
     EditParcelPropertiesHandler handler = OnEditParcelProperties;
     if (handler != null)
     {
         Delegate[] list = handler.GetInvocationList();
         return list.Cast<EditParcelPropertiesHandler>().All(h => h(user, parcel, groupPowers, m_scene) != false);
     }
     return true;
 }
        public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers groupPowers)
        {
            EditParcelPropertiesHandler handler = OnEditParcelProperties;
            if (handler != null)
            {
                Delegate[] list = handler.GetInvocationList();
#if (!ISWIN)
                foreach (EditParcelPropertiesHandler h in list)
                {
                    if (h(user, parcel, groupPowers, m_scene) == false) return false;
                }
                return true;
#else
                return list.Cast<EditParcelPropertiesHandler>().All(h => h(user, parcel, groupPowers, m_scene) != false);
#endif
            }
            return true;
        }
        private bool HasPower(GroupPowers power)
        {
            if (!instance.Groups.ContainsKey(group.ID))
                return false;

            return (instance.Groups[group.ID].Powers & power) != 0;
        }
Beispiel #36
0
        bool HasGroupPermission(UUID userId, Vector3 parcelLocation, GroupPowers powerRequested)
        {
            if (userId == UUID.Zero) return false;

            ILandObject parcel = m_scene.LandChannel.GetLandObject(parcelLocation.X, parcelLocation.Y);
            if (parcel == null) return false;

            if (parcel.landData.IsGroupOwned && IsAgentInGroupRole(parcel.landData.GroupID, userId, (ulong)powerRequested))
            {
                return true;
            }

            return false;
        }
Beispiel #37
0
 private bool TryGetGroupRoleRights(UGUI requestingAgent, UGI group, UUID roleID, out GroupPowers powers)
 {
     powers = GroupPowers.None;
     using (var conn = new NpgsqlConnection(m_ConnectionString))
     {
         conn.Open();
         using (var cmd = new NpgsqlCommand("SELECT Powers FROM grouproles AS r WHERE r.\"GroupID\" = @groupid AND r.\"RoleID\" = @grouproleid LIMIT 1", conn))
         {
             cmd.Parameters.AddParameter("@groupid", group.ID);
             cmd.Parameters.AddParameter("@grouproleid", roleID);
             using (NpgsqlDataReader reader = cmd.ExecuteReader())
             {
                 if (reader.Read())
                 {
                     powers = reader.GetEnum <GroupPowers>("Powers");
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Beispiel #38
0
        /// <summary>
        /// WARNING: This is not the only place permissions are checked! They are checked in each of the connectors as well!
        /// </summary>
        /// <param name="AgentID"></param>
        /// <param name="GroupID"></param>
        /// <returns></returns>
        public bool GroupPermissionCheck(UUID AgentID, UUID GroupID, GroupPowers permissions)
        {
            if (GroupID == UUID.Zero)
                return false;

            if (AgentID == UUID.Zero)
                return false;

            int ourPowers = -1;

            Dictionary<UUID, int> groupsCache;
            lock (AgentGroupPowersCache)
            {
                if (AgentGroupPowersCache.TryGetValue(AgentID, out groupsCache))
                {
                    if (groupsCache.ContainsKey(GroupID))
                    {
                        ourPowers = groupsCache[GroupID];
                        if (ourPowers == -1)
                            return false; //-1 means not in the group or not found in the cache, so stop it here so that we don't check every time
                    }
                }
            }
            //Ask the server as we don't know about this user
            if (ourPowers == -1)
            {
                GroupMembershipData GMD = m_groupData.GetAgentGroupMembership(AgentID, GroupID, AgentID);
                if (GMD == null)
                {
                    AddToGroupPowersCache(AgentID, GroupID, -1);
                    return false;
                }
                ourPowers = (int)((GroupPowers)GMD.GroupPowers);
                //Add to the cache
                AddToGroupPowersCache(AgentID, GroupID, ourPowers);
            }

            //The user is the group, or it would have been weeded out earlier, so check whether we just need to know whether they are in the group
            if (permissions == GroupPowers.None)
            {
                return true;
            }
            if ((((GroupPowers)ourPowers) & permissions) != permissions)
                return false;

            return true;
        }
 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene)
 {
     return(m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g));
 }
Beispiel #40
0
 /// <summary>
 /// Construct a new instance of the AgentDataReplyEventArgs object
 /// </summary>
 /// <param name="firstName">The agents first name</param>
 /// <param name="lastName">The agents last name</param>
 /// <param name="activeGroupID">The agents active group ID</param>
 /// <param name="groupTitle">The group title of the agents active group</param>
 /// <param name="groupPowers">The combined group powers the agent has in the active group</param>
 /// <param name="groupName">The name of the group the agent has currently active</param>
 public AgentDataReplyEventArgs(string firstName, string lastName, UUID activeGroupID,
     string groupTitle, GroupPowers groupPowers, string groupName)
 {
     this.m_FirstName = firstName;
     this.m_LastName = lastName;
     this.m_ActiveGroupID = activeGroupID;
     this.m_GroupTitle = groupTitle;
     this.m_GroupPowers = groupPowers;
     this.m_GroupName = groupName;
 }
Beispiel #41
0
 public bool HasGroupPower(UGUI agentOwner, UGI group, GroupPowers power) => (GetGroupPowers(agentOwner, group) & power) != 0;