예제 #1
0
    def _check_workspace_prop(self, controller, action):

        if 'user_id' in session and session['user_id'] or c.workspace.public:

            # Detect if workspace is frozen.
            c.workspace_frozen = bool(c.workspace.frozen
                                      or c.workspace.deep_frozen)

            # Show actions list.
            show_actions = [('teambox', 'show'), ('admin_teambox', 'show'),
                            ('skurl_teambox', 'show')]

            # Ajust permissions depending on weither workspace is frozen or not.
            if c.workspace_frozen:
                if not c.perms.hasRole('freeze'):
                    log.debug(
                        "_check_workspace_prop(): workspace is now frozen.")
                    c.perms.addRole('freeze')
                    session.save()
                    if (controller, action) not in show_actions:
                        # Only show change in non-show actions.
                        ui_warn(code='workspace_now_frozen',
                                hide_after_ms=5000)
                if (controller, action) in show_actions:
                    # Always show frozen message in show actions.
                    ui_warn(code='workspace_is_frozen', hide_after_ms=5000)

            if not c.workspace_frozen and c.perms.hasRole('freeze'):
                log.debug(
                    "_check_workspace_prop(): workspace is no longer frozen.")
                c.perms.dropRole('freeze')
                session.save()
                if (controller, action) not in show_actions:
                    # Only show change in non-show actions.
                    ui_info(code='workspace_now_unfrozen', hide_after_ms=5000)
예제 #2
0
    def resend_create(self, workspace_id):
        #verify email valid and send invitation mail
        if 'email' in request.params:
            if request.params['email'] == '':
                return render('invitation/resend_show.mako')
            user = User.get_by_lower_email(int(workspace_id), request.params['email'])
            if (user):
                # Instantiate a Kcd client.
                invitees = []
                invitee = WorkspaceInvitee()
                invitee.email_address = user.email
                invitee.send_mail = True
                
                invitees.append(invitee)
                message = "click on the link to join the teambox"
                
                kc = KcdClient(get_cached_kcd_external_conf_object())
                #TODO handle kcd errors, render confirmation messages
                kc.invite_users(workspace_id, message, invitees)
                ui_info(message="You have been re-invited to the Teambox, please check you email and follow instructions.")
                return render('invitation/resend_success.mako')

            else:
                #please contact ws owner
                ui_error(message="No invitation to this teambox had been sent to this email address." + \
                              " If you were not invited to this teambox, please contact the teambox owner.")
                return render('invitation/resend_show.mako')
                pass
        else:
            abort(403)
예제 #3
0
파일: base.py 프로젝트: fdgonthier/kas
    def _check_workspace_prop(self, controller, action):

        if 'user_id' in session and session['user_id'] or c.workspace.public:

            # Detect if workspace is frozen.
            c.workspace_frozen = bool(c.workspace.frozen or c.workspace.deep_frozen)

            # Show actions list.
            show_actions = [('teambox', 'show'), ('admin_teambox', 'show'), ('skurl_teambox', 'show')]

            # Ajust permissions depending on weither workspace is frozen or not.
            if c.workspace_frozen:
                if not c.perms.hasRole('freeze'):
                    log.debug("_check_workspace_prop(): workspace is now frozen.")
                    c.perms.addRole('freeze')
                    session.save()
                    if (controller, action) not in show_actions:
                        # Only show change in non-show actions.
                        ui_warn(code='workspace_now_frozen', hide_after_ms=5000)
                if (controller, action) in show_actions:
                    # Always show frozen message in show actions.
                    ui_warn(code='workspace_is_frozen', hide_after_ms=5000)
        
            if not c.workspace_frozen and c.perms.hasRole('freeze'):
                log.debug("_check_workspace_prop(): workspace is no longer frozen.")
                c.perms.dropRole('freeze')
                session.save()
                if (controller, action) not in show_actions:
                     # Only show change in non-show actions.
                    ui_info(code='workspace_now_unfrozen', hide_after_ms=5000)