Package org.jivesoftware.openfire.group

Examples of org.jivesoftware.openfire.group.Group


            note.addAttribute("type", "error");
            note.setText("Groups are read only");
            return;
        }
        // Get requested group
        Group group;
        try {
            group = GroupManager.getInstance().getGroup(data.getData().get("group").get(0));
        } catch (GroupNotFoundException e) {
            // Group not found
            note.addAttribute("type", "error");
View Full Code Here


            note.setText("Admin required parameter.");
            return;
        }

        // Sends the event
        Group group;
        try {
            group = GroupManager.getInstance().getGroup(groupname, true);

            // Fire event.
            GroupEventDispatcher.dispatchEvent(group, GroupEventDispatcher.EventType.admin_added, params);
View Full Code Here

        // If this is the first time that this group is loaded from CS, the OF will save this properties.
        // If this is not the first time and these properties haven't changed, then nothing happens
        // If this is not the first time but these properties have changed, then OF will update it's saved data.
        // And this is OK, event if this "getGroup" is to be used in a "change group properties event", the group should
        // always show the last information.
        return new Group(name, description, members, administrators, properties);
    }
View Full Code Here

        if (groups != null && !groups.isEmpty()) {
            GroupManager groupManager = GroupManager.getInstance();
            for (String groupName : groups) {
                try {
                    Group group = groupManager.getGroup(groupName);
                    if (group.isUser(jid.getNode())) {
                        return true;
                    }
                }
                catch (GroupNotFoundException e) {
                    Log.debug(e.getMessage(), e);
View Full Code Here

            note.setText("Member required parameter.");
            return;
        }

        // Sends the event
        Group group;
        try {
            group = GroupManager.getInstance().getGroup(groupname, true);

            // Fire event.
            GroupEventDispatcher.dispatchEvent(group, GroupEventDispatcher.EventType.member_removed, params);
View Full Code Here

        // Adds the type of change
        params.put("type", type);

        // Sends the event
        Group group;
        try {
            group = GroupManager.getInstance().getGroup(groupname, true);

            // Fire event.
            GroupEventDispatcher.dispatchEvent(group, GroupEventDispatcher.EventType.group_modified, params);
View Full Code Here

            note.addAttribute("type", "error");
            note.setText("Groups are read only");
            return;
        }
        // Get requested group
        Group group;
        try {
            group = GroupManager.getInstance().getGroup(data.getData().get("group").get(0));
        } catch (GroupNotFoundException e) {
            // Group not found
            note.addAttribute("type", "error");
            note.setText("Group name does not exist");
            return;
        }

        boolean withErrors = false;
        for (String user : data.getData().get("users")) {
            try {
                group.getAdmins().remove(new JID(user));
                group.getMembers().remove(new JID(user));
            } catch (Exception e) {
                Log.warn("User not deleted from group", e);
                withErrors = true;
            }
        }
View Full Code Here

        }
       
        private void addUserToGroup(User user) {
            try {
                GroupManager groupManager =  GroupManager.getInstance();
                Group group = groupManager.getGroup(getGroup());
                group.getMembers().add(XMPPServer.getInstance().createJID(user.getUsername(), null));
            }
            catch (GroupNotFoundException e) {
                Log.error(e.getMessage(), e);
            }
        }
View Full Code Here

        return pluginManager.getDescription(this);
    }

    public void processPacket(Packet packet) {
        boolean canProceed = false;
        Group group = null;
        String toNode = packet.getTo().getNode();
        // Check if user is allowed to send packet to this service[+group]
        boolean targetAll = "all".equals(toNode);
        if (targetAll) {
            // See if the user is allowed to send the packet.
            JID address = new JID(packet.getFrom().toBareJID());
            if (allowedUsers.isEmpty() || allowedUsers.contains(address)) {
                canProceed = true;
            }
        }
        else {
            try {
                if (toNode != null) {
                    group = groupManager.getGroup(toNode);
                    boolean isGroupUser = group.isUser(packet.getFrom()) ||
                            group.isUser(new JID(packet.getFrom().toBareJID()));
                    if (disableGroupPermissions || (groupMembersAllowed && isGroupUser) ||
                            allowedUsers.contains(new JID(packet.getFrom().toBareJID()))) {
                        canProceed = true;
                    }
                }
View Full Code Here

        return match;
    }


    private boolean packetToFromGroup(String rulegroup, JID packetToFrom) {
        Group group = null;
        try {
            group = GroupManager.getInstance().getProvider().getGroup(rulegroup);
        } catch (GroupNotFoundException e) {
            e.printStackTrace();
        }
        if (group == null) {
            return false;
        } else {
            if (group.isUser(packetToFrom)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of org.jivesoftware.openfire.group.Group

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.