Request Android Permissions.

@param context     The Context of the Activity or the Fragment.
@param permissions The Permission you are need.
@param response    Result callback.
557192
public static void getPermission(@NonNull Activity context, String permissions, @NonNull Response response) {
        getPermission(context, new String[]{permissions}, response);
    }
123652
@PreAuthorize(
            "hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))")
    @RequestMapping(value = "/permissions/principals.json", method = RequestMethod.GET)
    public ModelAndView getPrincipals(
            @RequestParam(value = "q") String query,
            HttpServletRequest request,
            HttpServletResponse response)
            throws Exception {

        /*
         *  Add groups and people matching the search query to the JSON model
         */

        ModelAndView mv = new ModelAndView();
        List<JsonEntityBean> groups = new ArrayList<JsonEntityBean>();
        groups.addAll(listHelper.search(EntityEnum.GROUP.toString(), query));
        Collections.sort(groups);
        mv.addObject("groups", groups);

        List<JsonEntityBean> people = new ArrayList<JsonEntityBean>();
        people.addAll(listHelper.search(EntityEnum.PERSON.toString(), query));
        Collections.sort(people);
        mv.addObject("people", people);
        mv.setViewName("json");

        return mv;
    }
71885
public void requestAfterExplanation(@NonNull String[] permissions) {
        ArrayList<String> permissionsToRequest = new ArrayList<>();
        for (String permissionName : permissions) {
            if (isPermissionDeclined(permissionName)) {
                permissionsToRequest.add(permissionName); // add permission to request
            } else {
                permissionCallback.onPermissionPreGranted(permissionName); // do not request, since it is already granted
            }
        }
        if (permissionsToRequest.isEmpty()) return;
        permissions = permissionsToRequest.toArray(new String[permissionsToRequest.size()]);
        context.requestPermissions(permissions, REQUEST_PERMISSIONS);
    }
36826
def request_permissions(self, permissions):
        
        f = self.create_future()

        #: Old versions of android did permissions at install time
        if self.api_level < 23:
            f.set_result({p: True for p in permissions})
            return f

        w = self.widget
        request_code = self._permission_code
        self._permission_code += 1  #: So next call has a unique code

        #: On first request, setup our listener, and request the permission
        if request_code == 0:
            w.setPermissionResultListener(w.getId())
            w.onRequestPermissionsResult.connect(self._on_permission_result)

        def on_results(code, perms, results):
            #: Check permissions
            f.set_result({p: r == Activity.PERMISSION_GRANTED
                          for (p, r) in zip(perms, results)})

        #: Save a reference
        self._permission_requests[request_code] = on_results

        #: Send out the request
        self.widget.requestPermissions(permissions, request_code)

        return f
348
@Override @NonNull @CheckReturnValue public Observable<Permission> requestEach(@NonNull final String... permissions) {
    return Observable.just(TRIGGER)
        .compose(ensureEach(permissions));
  }
863794
@Override
    public void addPermissions(IPermission[] permissions) throws AuthorizationException {
        if (permissions.length > 0) {
            getPermissionStore().add(permissions);
            if (this.cachePermissions) {
                removeFromPermissionsCache(permissions);
            }
        }
    }
38698
private boolean checkPermissions(Activity activity) {
        String[] permissions = getRequiredAndroidPermissions();
        return handler.areAllPermissionsGranted(activity, permissions);
    }
1266102
public void setResourcePermissions(Map<String, Map<String, List<String>>> resourcePermissions) {
		this.resourcePermissions = resourcePermissions;
	}
1368780
static void requestPermission(Source source, String[] permissions) {
        Intent intent = new Intent(source.getContext(), BridgeActivity.class);
        intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_PERMISSION);
        intent.putExtra(KEY_PERMISSIONS, permissions);
        source.startActivity(intent);
    }
830494
@PreAuthorize(
            "hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))")
    @RequestMapping(value = "/permissions/owners/{owner}.json", method = RequestMethod.GET)
    public ModelAndView getOwners(
            @PathVariable("owner") String ownerParam, HttpServletResponse response) {

        IPermissionOwner owner;

        if (StringUtils.isNumeric(ownerParam)) {
            long id = Long.valueOf(ownerParam);
            owner = permissionOwnerDao.getPermissionOwner(id);
        } else {
            owner = permissionOwnerDao.getPermissionOwner(ownerParam);
        }

        // if the IPermissionOwner was found, add it to the JSON model
        if (owner != null) {
            ModelAndView mv = new ModelAndView();
            mv.addObject("owner", owner);
            mv.setViewName("json");
            return mv;
        }

        // otherwise return a 404 not found error code
        else {
            response.setStatus(HttpServletResponse.SC_NOT_FOUND);
            return null;
        }
    }
295896
protected RequestContext createRequestContext(HttpServletRequest request, HttpServletResponse response) {
        return new RequestContext(request, response, servletContext);
    }
1255103
@PreAuthorize(
            "hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))")
    @RequestMapping(value = "/permissions/activities.json", method = RequestMethod.GET)
    public ModelAndView getActivities(@RequestParam(value = "q", required = false) String query) {

        if (StringUtils.isNotBlank(query)) {
            query = query.toLowerCase();
        }

        List<IPermissionActivity> activities = new ArrayList<>();
        Collection<IPermissionOwner> owners = permissionOwnerDao.getAllPermissionOwners();

        for (IPermissionOwner owner : owners) {
            for (IPermissionActivity activity : owner.getActivities()) {
                if (StringUtils.isBlank(query)
                        || activity.getName().toLowerCase().contains(query)) {
                    activities.add(activity);
                }
            }
        }
        Collections.sort(activities);

        ModelAndView mv = new ModelAndView();
        mv.addObject("activities", activities);
        mv.setViewName("json");

        return mv;
    }
759181
private static List<String> getRationalePermissions(Source source, String... permissions) {
        List<String> rationaleList = new ArrayList<>(1);
        for (String permission : permissions) {
            if (source.isShowRationalePermission(permission)) {
                rationaleList.add(permission);
            }
        }
        return rationaleList;
    }
1213522
@Nullable public static String declinedPermission(@NonNull Fragment context, @NonNull String[] permissions) {
        for (String permission : permissions) {
            if (isPermissionDeclined(context, permission)) {
                return permission;
            }
        }
        return null;
    }
981436
protected function getBypassedAccess($permissions, array $context): bool
    {
        $newPermissions = [false];
        if (is_array($permissions) && array_key_exists('NO_BYPASS', $permissions)) {
            $newPermissions['NO_BYPASS'] = $permissions['NO_BYPASS'];
        }

        try {
            return $this->lpProxy->checkAccess($newPermissions, $context);
        } catch (\Exception $e) {
        }

        return false;
    }
1285471
public ResponseBuilder withAskForPermissionsConsentCard(List<String> permissions) {
        this.card = AskForPermissionsConsentCard.builder()
                .withPermissions(permissions)
                .build();
        return this;
    }
203063
@VisibleForTesting
    void checkPermissionStatus(@NonNull Context context) {
        boolean hasPermission = getPermissionChecker().hasAnimationPermission(context);
        if (!hasPermission) {
            throw new IllegalStateException(getPermissionErrorMessage());
        }
    }